Apache redirect to block selective paths

Hi

I have a drupal site example.com and there are many subsections like
example.com/noname
example.com/dummy
example.com/another

now I want to enable access to example.com/dummy only
and if user types in example.com they get redirected to example.com/dummy
and all other paths are also denied.

auto,

Is there a question in that? More important (to me), what have you tried to perform whatever it is in your question?

Regards,

DK

sorry didn’t explained the question

RewriteCond %{QUERY_STRING} !(^|&)q=foobar(/|&|$) [NC]
RewriteCond %{REMOTE_ADDR} !^192\.168
RewriteRule .* - [F]

I want to enable access to foobar from any IP but to access other query string user must be in 192.168 network.

I did above and it worked but now outside users can’t see images on web page.
what I am doing wrong here?

I have fixed above issue . the problem was in flag. in another rule there was L flag. I changed it to C and everything worked.

another issue I noticed is that when somebody goes to example.com they can see the page but everything else except example.com/foobar is not working.

how I can disable access to example.com but keep access to example.com/foobar

thanks.

Add it as a condition


RewriteCond %{QUERY_STRING} !(^|&)q=foobar(/|&|$) [NC]
[B]RewriteCond %{REQUEST_URI} !^/foobar[/B]
RewriteCond %{REMOTE_ADDR} !^192\\.168 
RewriteRule .* - [F]

:slight_smile:

Thanks.

mod_rewrite is a beast. reading tutorials to know it better.