You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "motty.cruz" <mo...@gmail.com> on 2011/01/06 16:40:08 UTC

[users@httpd] Apache RewriteEngine

Hello, 
I have Apache 2.2 installed on FreeBSD 8.1, and would like to restrict
content from /wp-content/media to be re-direct to / (root of directory). Any
suggestions, of how to best accomplish that goal? 

Thanks, any help appreciated, 
-Motty

RE: [users@httpd] Apache RewriteEngine

Posted by "motty.cruz" <mo...@gmail.com>.
I have pdf files under /wp-content/media/guides/guide1.pdf

In order for users to see those pdf files they have to login we have set up a login page. However if they go directly to www.domain.com/wp-content/media/guides/guide1.pdf Apache should re-direct them to the login page, but it is not re-directing people to the login page. 

My goal is that if someone goes directly to www.domain.com/wp-conetnt/media/guides/guide1(or2).pdf they should be re-redirect to the login page. 

So far this is what I have, if the cookie is present they should be able to view any content in directory above mentioned. 

RewriteCond %{HTTP_COOKIE} !login_cookie=true
RewriteRule .* /wp-content/media/

Please help!,
Thanks, 
-motty


-----Original Message-----
From: Igor Galić [mailto:i.galic@brainsware.org] 
Sent: Thursday, January 06, 2011 8:23 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache RewriteEngine


----- "Eric Covener" <co...@gmail.com> wrote:

> On Thu, Jan 6, 2011 at 10:40 AM, motty.cruz <mo...@gmail.com>
> wrote:
> > Hello,
> >
> > I have Apache 2.2 installed on FreeBSD 8.1, and would like to
> restrict
> > content from /wp-content/media to be re-direct to / (root of
> directory). Any

What exactly does that actualy mean?

> > suggestions, of how to best accomplish that goal?
> >
> 
> If you want them all to go directly to the root
> 
> RedirectMatch ^/wp-content/media/ /
> 
> If the files are actually under the root and you want to preserve
> what
> came after media/:
> 
> Redirect /wp-content/media/ /
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache RewriteEngine

Posted by "motty.cruz" <mo...@gmail.com>.
Hello Igor, 

I tried your suggestion but did not because I want people to view files in /wp-content/media/ only if they have a cookie( if they login). The suggested 
RedirectMatch ^/wp-content/media/ /    <-- won't let me see files in /wp-content/media even if I succefully log in. 

I tried this furum, is exactly what I want to do however the last 
http://www.webmasterworld.com/forum92/424.htm

rewriteCond %{HTTP_COOKIE} uin 
rewriteRule ^/.*$ /main.html [L

does not seem to function for me, any ideas? 

Thanks, 
-motty

-----Original Message-----
From: Igor Galić [mailto:i.galic@brainsware.org] 
Sent: Thursday, January 06, 2011 8:23 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache RewriteEngine


----- "Eric Covener" <co...@gmail.com> wrote:

> On Thu, Jan 6, 2011 at 10:40 AM, motty.cruz <mo...@gmail.com>
> wrote:
> > Hello,
> >
> > I have Apache 2.2 installed on FreeBSD 8.1, and would like to
> restrict
> > content from /wp-content/media to be re-direct to / (root of
> directory). Any

What exactly does that actualy mean?

> > suggestions, of how to best accomplish that goal?
> >
> 
> If you want them all to go directly to the root
> 
> RedirectMatch ^/wp-content/media/ /
> 
> If the files are actually under the root and you want to preserve
> what
> came after media/:
> 
> Redirect /wp-content/media/ /
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache RewriteEngine

Posted by Igor Galić <i....@brainsware.org>.
----- "Eric Covener" <co...@gmail.com> wrote:

> On Thu, Jan 6, 2011 at 10:40 AM, motty.cruz <mo...@gmail.com>
> wrote:
> > Hello,
> >
> > I have Apache 2.2 installed on FreeBSD 8.1, and would like to
> restrict
> > content from /wp-content/media to be re-direct to / (root of
> directory). Any

What exactly does that actualy mean?

> > suggestions, of how to best accomplish that goal?
> >
> 
> If you want them all to go directly to the root
> 
> RedirectMatch ^/wp-content/media/ /
> 
> If the files are actually under the root and you want to preserve
> what
> came after media/:
> 
> Redirect /wp-content/media/ /
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache RewriteEngine

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jan 6, 2011 at 10:40 AM, motty.cruz <mo...@gmail.com> wrote:
> Hello,
>
> I have Apache 2.2 installed on FreeBSD 8.1, and would like to restrict
> content from /wp-content/media to be re-direct to / (root of directory). Any
> suggestions, of how to best accomplish that goal?
>

If you want them all to go directly to the root

RedirectMatch ^/wp-content/media/ /

If the files are actually under the root and you want to preserve what
came after media/:

Redirect /wp-content/media/ /

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org