Reputation: 599
i am working in my development server.
It doesn't have the domain name instead i used to access it via IP address. i want to make redirect script from
http://11.10.11.19/index.php to http://11.10.11.19/
(ip address given is sample)
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ 11\.10\.11\.19$ [R=301,L]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ http://www.domainname.com [R=301,L]
The same thing when i tried with my live site and in localhost it is working.
Upvotes: 2
Views: 212
Reputation: 41848
It sounds to me like you want to redirect index.php
to the root of the domain, whether you are accessing it by IP or by name.
This should do the trick in both cases:
RewriteEngine On
RewriteRule ^()index\.php$ $1 [L,R]
Upvotes: 1