I want to set up my homepage but im not sure if ill use plain HTML or PHP-generated HTML. So i thought about content-negotiation, so i would not set links to example.com/page.html or .php but to example.com/page. If i then decided to switch from HTML to PHP i wouldnt have to change all my URIs. Apache per default supports this behavior.
But I even want more: If somebody accesses /page.html I want him to get redirected (301) to /page and if somebody tries to access /page.php he also gets redirected to /page.
So i set this up:
- Code: Select all
RewriteRule ^(.*)\.(html|php|gif|jpeg|png|txt)$ http://www.plenz.com/$1 [NS,NC,R=301,L]
Now it works, but every time im redirected to /page im redirected to /page.html (subrequest?). So i added "NS" (for no sub-request) but it still doesnt work. (Infinite loop)
Any ideas?