RewriteCond help needed

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am trying to use

RewriteEngine On
RewriteBase /
RewriteRule  ^([a-z])([^/]*)/?$  $1/$1$2/ [L]

for the purposes of overwriting  mydomain/andrew/ by contents located
mydomain/a/andrew/ etc.

however it also overwrites main domain request /
, cgi and a bunch of plain files

how do I set RewriteCond to exclude main domain, certain subdirectories
and certain files to be overwritten?



Re: RewriteCond help needed wrote:

Quoted text here. Click to load it

Hi Dimag,
You're not specific about exactly what URLs you want to rewrite, so it
isn't possible to give a specific RewriteCond. But you could start with
something like this and replace "regex" with something that matches all
of the paths to which you want to apply the RewriteRule that follows:
RewriteCond  %  regex

Try asking in alt.apache.configuration. The people there actually know
what they're talking about (unlike me!)

Good luck

Philip /
Bulk HTML validation, link checking and more

Re: RewriteCond help needed

And lo, Philip didst speak in alt.www.webmaster:

Quoted text here. Click to load it

Don't exclude.  Check if the target directory exists instead.

# ----------------------------------------------------------
RewriteEngine  On

RewriteBase  /

RewriteCond  %/$1/$1$2/  -d
RewriteRule  ^([a-z])([^/]+)/?(.*)$     $1/$1$2/$3  [L]
# ----------------------------------------------------------

Tested and working on my Apache 1.3.34 server.

Quoted text here. Click to load it

You'd be wise, Dimag, to get a real newsreader, and dump Google Groups.  
Since many in this group (including myself) have Google Groups killfiled,  
had Philip not replied to your post, I never would have seen it.

Those with legitimate questions, such as yourself, make up only a small  
minority of the posts that come out of GG.


The technical axiom that nothing is impossible sinisterly implies the  
pitfall corollary that nothing is ridiculous.
- - Orca Search: Full-featured  
spider and site-search engine

Re: RewriteCond help needed


thank you, thank you, thank you!!!
this code is exactly what I needed.

Best regards,


GreyWyvern wrote:
Quoted text here. Click to load it

Site Timeline