HighDots Forums  

Redirect vs Rewrite

Website Design comp.infosystems.www.authoring.site-design


Discuss Redirect vs Rewrite in the Website Design forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Garmt de Vries
 
Posts: n/a

Default Redirect vs Rewrite - 12-02-2003 , 07:55 AM






A while ago, when my website moved to a new provider, I've had to
change all .html extensions to .shtml, otherwise the SSI wouldn't get
parsed. Now I've been trying to find a means of telling indexing
robots that the file foo.html has been permanently moved to foo.shtml.
I found two solutions:

1) In .htacces, write a line
Redirect permanent /foo.html http://www.domain.nl/foo.shtml
for each and every file on the website.

2) In .htacces, use a RewriteRule to change a request for foo.html to
foo.shtml:
# parse out basename, but remember the fact
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
# rewrite to document.phtml if exists
RewriteCond %{REQUEST_FILENAME}.shtml -f
RewriteRule ^(.*)$ $1.shtml [S=1]
# else reverse the previous basename cutout
RewriteCond %{ENV:WasHTML} ^yes$
RewriteRule ^(.*)$ $1.html

If I use 1), a robot will be told (via a code 301) that it should
update its data. If I use 2), a robot (or any other user) will not
notice the change, and my pages will keep getting referred to as
foo.html. Is this correct, or am I mistaken here?

Is there a way to use wildcards in a Redirect line, something like
Redirect permanent /*.html http://www.domain.nl/*.shtml
?

Or should I just use the RewriteRule, and not worry about how my files
are listed, because the URI http://www.domain.nl/foo.html will also
point to the correct file?

Thanks in advance for your advice.

Best regards,
Garmt.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.