Forum Moderators: phranque
/blah/ /example/file.php /blah/ in the browser /blah/?u=10 /example/file.php?u=10 /blah/?u=10&b=99 /example/file.php?u=10&b=99 RewriteRule ^visible-url-here-beginning-with-first-directory-name /target-url-here-with-leading-slash-for-root [L] RewriteRule ^requested-filepath /internal-resource-that-serves-content [L] RewriteRule ^blah/ /example/file.php [L] /example/file.php /blah/ /example/file.php and see the same content, which is now duplicate content. is there any way to get that URL redirected to /blah/? It now shows the content from
/example/file.php
at
/blah/
What do you do with the original folder though... where the info originally came from. Presumably you do a redirect to the new folder, otherwise you'll end up with duplicate content, But when the new folder tries to grab the stuff from the original folder, wont it just be redirected too.
This new rule also needs a preceding RewriteCond looking at %THE_REQUEST to prevent an infinite loop.
RewriteCond %{THE_REQUEST} old-ugly-url
RewriteRule old-ugly-url http://www.example.com/new-pretty-url [R=301,L] RewriteCond %{THE_REQUEST} /example/file.php RewriteRule /example/file.php http://localhost/blah/ [R=301,L] RewriteCond %{THE_REQUEST} /example/file\.php
RewriteRule /example/file\.php http://example.com/blah/ [R=301,L]
RewriteCond %{THE_REQUEST} /example/file\.php
RewriteRule /example/file\.php http://example.com/blah/ [R=301,L]
RewriteCond %{THE_REQUEST} ^example/file\.php
RewriteRule /example/file\.php http://example.com/blah/ [R=301,L]
RewriteCond %{THE_REQUEST} ^example/file\.php
RewriteRule ^example/file\.php http://example.com/blah/ [R=301,L]