apache - Redirecting multiple old pages to new pages -



apache - Redirecting multiple old pages to new pages -

i'm changing construction of pages , need re-direct old ones new pages.

here illustration of of next pages need move, in pages folder needs moved down, old pages showed php extension.

www.example.com/pages/index.php www.example.com/index www.example.com/pages/contact_us.php www.example.com/contact_us

here have far

options +followsymlinks -multiviews rewriteengine on rewriterule ^pages/(.*)$ /$1 [l,r=301]

edit

the rewrite above works makes pages such example.com/contact_us unusable, have set extension .php @ end, not problem had prior rule

you can utilize code in document_root/.htaccess file:

rewriteengine on rewritebase / rewritecond %{the_request} \s/+pages/(.+?)\.php[\s?] [nc] rewriterule ^ /%1 [r=302,l,ne] rewritecond %{request_filename} !-d rewritecond %{document_root}/pages/$1\.php -f [nc] rewriterule ^(.+?)/?$ pages/$1.php [l]

apache .htaccess mod-rewrite

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -