Re: RewriteRule/Cond Assistance

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

 



At 07:11 PM 7/16/2007, you wrote:
On 7/16/07, Mike @ Levrah <sid_apache@xxxxxxxxxx> wrote:
Hey guys.

It looks like I'm not the only one having rewriterule/cond fun lately. LOL

I'm having a tough time figuring this out, and it's probably
something simple that I'm making harder than it is.

Rather than post examples of what I've tried - since none of them
work - and it'll show my major ignorance hehe...

I think it always works better when you start by showing us your best
guess at the correct config and explain exactly what happens when you
try it (including log excerpts).

But something to get you started could be
RewriteRule ^/index.php - [L]
RewriteRule ^/assets - [L]
RewriteRule ^/support - [L]
RewriteRule ^/(.+) /index.php?$1

(I'm just guessing that your index page is php.)

Joshua.

Well, I guess I wasn't as off as I thought. I had the same thing except no dash between the file/dir name and the "[L]". I was getting a 500 Internal Server Error.

I tried it with the dash and got the same 500 Internal Server Error

Here's my code w/the domain name changed to blah and the IP changed to "<IP>"

##################################################
# Turn RewriteEngine ON
##################################################
RewriteEngine on
##################################################
# Protect against off-site graphic linking
##################################################
RewriteRule (.*/illegal-link.gif) $1 [last]
RewriteCond %{HTTP_REFERER} !^($|(http://)?[^/]*(blah|<IP>)) [NC]
RewriteRule \.(jpe?g|gif|png) http://www.blah.com/support/img/sp-1w1h.gif [R]
##################################################
# Forces links to non-existent directories to populate index with directory_name as arg of index
# while ignoring certain directories that we don't want this behavior to affect
##################################################
RewriteRule ^/index.mv [L]      #       Don't affect main index
RewriteRule ^/admin [L]         #       Don't affect /admin directory
RewriteRule ^/gallery [L]       #       Don't affect /gallery directory
RewriteRule ^/support [L]       #       Don't affect /support directory
RewriteRule ^/(.+) /index.mv?$1 # Send all other requests to index with directory_name as arg of index

Here's the relevant part of the error_log:

[Mon Jul 16 20:46:16 2007] [alert] [client <IP>] /home/httpd/vhosts/blah.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters, referer: http://www.blah.com/webfinds/index.mv [Mon Jul 16 20:47:34 2007] [alert] [client <IP>] /home/httpd/vhosts/blah.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters, referer: http://www.blah.com/webfinds/index.mv [Mon Jul 16 20:47:37 2007] [alert] [client <IP>] /home/httpd/vhosts/blah.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters [Mon Jul 16 20:53:41 2007] [alert] [client <IP>] /home/httpd/vhosts/blah.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters

I intend to put the /webfinds directory in as an exception, but left it out intentionally so I could test with that directory to see if it sent me to the main index with ?webfinds as the arg. If that had of happened, I was going to put /webfinds in as an exception and try again (expecting the be able to access that directory normally) and then move on to testing the other exception directories and finally the main page.

But the Internal Server Error has been kickin'my ... well ... you know. So I haven't gotten past the first test. LOL

-mike


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[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