سؤال

Is it possible to create a rewrite code that includes a wildcard?

for example any request for:

 http://example.com/something1/something2/*

would redirect to:

 http://example.com/newthing

AND

will it matter where in the .htaccess file I place the rewrites?

هل كانت مفيدة؟

المحلول

This should work for you:

RewriteEngine On
RewriteRule ^something1/something2/(.*)$ /$1 [R=302,L]

It should change http://example.com/something1/something2/test to http://example.com/test

EDIT:

RewriteEngine On
RewriteRule ^shirts/(.*)$ /clothing.html [R=301,L]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top