- Code: Select all
RewriteEngine On
RewriteRule ^aboutus/?$ aboutus.php [NC]
RewriteRule ^contact/?$ contact.php [NC]
Expected behaviour: www.example.com/aboutus or www.example.com/aboutus/ calls www.example.com/aboutus.php internally. Same with "contact".
This works on my development machine, but on the hosted site, it doesn't work, throwing a 404 in both cases. Calling www.example.com/aboutus.php directly is OK, nothing wrong with the actual file. Also, .htaccess is parsed and mod_rewrite is loaded on hosted site.
Strangely, what does work is any combination of case-swapping, e.g. /Aboutus or /abOuTus. But /aboutus gives me a 404.
As an experiment, I added
- Code: Select all
RewriteRule ^foobar/?$ aboutus.php [NC]
Requesting /foobar or /foobar/ gives me the aboutus.php page, which is correct but shows the inconsistency.
So the pattern seems to be: If the url that needs to be rewritten matches the case and the name (minus extension) of the corresponding file, it does not work.
Very strange indeed. I don't have access to the rewrite log, unfortunately.
Any suggestions gratefully accepted