Forbid the site's browsing to anyone but not to me |
[eluser]Alhazred[/eluser]
I have to put online a website, but before to allow to anyone to use it, I need to test it online. During the test I want that anyone will see a "work in progress" page, but I want to be able to use it normally. I know that I could put a redirect to any view file or controller, but there are a lot, so I was thinking something different, something easier to set and unset. I can't put a redirect only to the main controller because if in example some one writes www.website.com/aboutus he opens the "About us" page and from there he could use the menu to navigate. I was thinking to put something into the index.php, where any request has to pass, but I don't know if it is possible to modify it to have what I need. Do you have any suggestion?
[eluser]Alhazred[/eluser]
Just to say what I'm thinking: my idea was to read the $_SERVER['REMOTE_ADDR'] value and according to that decide if it's me or some one else. Of course my current IP address would be hardcoded and changed manually if needed.
[eluser]TheFuzzy0ne[/eluser]
Do you use an .htaccess file? Here's the code from mine I use for when I put the site into maintenance mode. Hopefully it will help you. Code: #RewriteEngine On Just use your own IP address, and make sure you have a file in your Web root called maintenance_mode.php (with a message to your users), then uncomment those lines.
[eluser]Alhazred[/eluser]
Yes, of course I use an .htaccess file, it is very simple at the moment Code: RewriteEngine on Code: RewriteEngine on I've put a maintenance.php file in the web root. if I try to access the site it works regularly, I've tried to change the IP address and I obtain an Internal Server Error message. I've tried to comment my 2 additional lines RewriteCond $1 !^(index\.php|static|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] in this case: with 127.0.0.1 I can access the home page, but as I click any link, I got an error because the url is not correctly routed by CI If I put a different IP into the .htaccess I'm redirected to the maintenance.php page So, what I have at the moment is: - I can use the site, but other people gets an error - other people gets and under maintenance page, but I cant use the site How do you set your .htaccess to use the website and give the under maintenance page to the users?
[eluser]TheFuzzy0ne[/eluser]
Try this: Code: RewriteEngine on The order was incorrect, so it was mangling the URL. I've also edited your existing .htaccess data to make it a little more robust. If that doesn't work, you may need to substitute the IP address with your actual internal IP address. i.e 192.168.0.1, or whatever.
|
Welcome Guest, Not a member yet? Register Sign In |