Reputation: 1712
I want to write a rule in htaccess that always redirects http://example.com/index.aspx
or http://www.example.com/index.aspx
to http://example.com
.
This is what I have tried so far:
RewriteCond %{REQUEST_URI} ^/index.aspx [NC]
RewriteRule ^(.*)$ http://%1 [R=301,L]
but it's not working properly.
Thanks
Upvotes: 1
Views: 81
Reputation: 18671
You can use just one rule:
RewriteRule ^index\.aspx$ http://%{HTTP_HOST} [NC,R=301,L]
Upvotes: 2