Restrict access to site pages except specific url

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,

I’m trying to configure apache 2.4 to allow access only to a specific set of pages when accessed through a hostname.

 

So i have two virtualhosts configured , both pointing to the same physical path/site.

Let’s say www.mainsite.com and blog.mainsite.com .

There are categories for different sections of the site like /news , /contact , /blog and so on.

What i would like is that when the site is accessed through blog.mainsite.com , only the subpages under /blog to be accessible like /blog/artile-url. , when accessing blog.mainsite.com to be automatically redirected to /blog , and any other page except /blog(/?artilec-url) to be also redirected back to /blog

 

 

I’ve tried with

RewriteCond  %{ REQUEST_URI}             !/blog/?.*

RewriteRule ^$                http://%{ HTTP_HOST}/blog [R=302,L]

 

But this creates a redirect loop and not sure how to break out of it. I know that RewriteRule is evaluated first , and how i translate this rules is when accessing the site redirect the client to /blog , next evaluate the condition if requested URL does not contain /blog apply the rewriterule else do nothing.

 


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux