Forum Moderators: phranque
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^ugly\.html$ pretty.html [R=301,L]
RewriteRule ^pretty\.html$ ugly.html [L]
# comment your code so you know what each chunk does.
The redirect needs to additionally specify the domain name in the redirect target.
RewriteBase /
The redirect also needs a preceding RewriteCond checking THE_REQUEST so that only external direct client requests are redirected.
RewriteCond %{THE_REQUEST}
Options +FollowSymLinks
#
RewriteEngine On
RewriteBase /
#
# Externally redirect direct client request for 'ugly.html' filepath to /pretty.html URL
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /ugly\.html\ HTTP/
RewriteRule ^ugly\.html$ http://www.example.com/pretty.html [R=301,L]
#
# Internally rewrite requests for /pretty.html URL-path to /ugly.html filepath
RewriteRule ^pretty\.html$ /ugly.html [L]
[edited by: jdMorgan at 3:13 pm (utc) on Jun 28, 2010]