Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this htaccess rule

RewriteCond %{REMOTE_ADDR} ^xxx\.xxx\.xxx\.xxx
RewriteCond %{REQUEST_URI} !/path/to/file.php$
RewriteRule $ /path/to/file.php [R=302,L]

and the purpose to is redirect a specific IP who visits any page to one page in particular /path/to/file.php

This is working for URLs which have spaces in them. But it is not working for URLs which contain %20 instead of spaces, and URLs which have no spaces. Where have I gone wrong with this?

share|improve this question

1 Answer 1

I think if you change this line:

RewriteRule $ /path/to/file.php [R=302,L]

to this:

RewriteRule ^(.*)$ /path/to/file.php [R=302,L]

you will be good to go. Make sure you clear your browser cache when you test redirects.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.