Reputation: 11
I'm using the Mod_Rewrite module to rewrite urls.
This is my RewriteRule:
RewriteRule ^index index.php
RewriteRule ^page page.php
If I'm going to localhost/page the content of page.php is shown. But when I go to localhost/index the url get rewritten to:
http://localhost/C:/Users/Username/Documents/Xampp/htdocs/index.php
Thank you.
Edit: The full .htaccess code:
RewriteEngine On
RewriteBase /
RewriteRule ^page page.php
RewriteRule ^index index.php
RewriteRule ^about about.php
RewriteRule ^contact contact.php
Upvotes: 1
Views: 54
Reputation: 785128
Try these rules with anchors $
:
RewriteEngine On
RewriteBase /
RewriteRule ^page/?$ page.php [L]
RewriteRule ^index/?$ index.php [L]
RewriteRule ^about/?$ about.php [L]
RewriteRule ^contact/?$ contact.php [L]
Alternatively you can try this line on top of your .htaccess:
Options +MultiViews
Upvotes: 0