Forum Moderators: phranque

Message Too Old, No Replies

redirect everyone buy me to / or /index.html

         

CrazyBigGaz

4:45 pm on Sep 25, 2011 (gmt 0)

10+ Year Member



Hi,

I would like to do the following with my .htaccess while I develop my site.

I would like to send everyone to [mydomain.com...] or [mydomain.com...]

But allow my IP full access to the site

How would I go about doing this redirection

Note that is a typo in the title should be: but

Regards,
Garry

[edited by: CrazyBigGaz at 4:51 pm (utc) on Sep 25, 2011]

CrazyBigGaz

4:50 pm on Sep 25, 2011 (gmt 0)

10+ Year Member



Got to do what I want


RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
RewriteRule .php http://www.domain.com [R=302,L]


This will allow me to setup my site which is using .php files.

g1smd

5:05 pm on Sep 25, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteBase /
is the default and does not need to be specified.

Without end anchoring, the
^127\.0\.0\.1
pattern also matches 127.0.0.111 and 127.0.0.199 etc.

The
.php
pattern means
<any character>php
. If you mean
<literal period>php
then change
.
to
\.
here.

Additionally, your rule target should end with a trailing slash.

Finally, you should never redirect to a named index file.