Forum Moderators: bakedjake

Message Too Old, No Replies

Mod rewrite to skip directories

how to stop url rewriting if its directory?

         

jcodemasters

9:23 pm on Oct 23, 2006 (gmt 0)

10+ Year Member



Hello,
i have a site where i want to add mod rewrite.. to rewrite my users profile..

currently it works this

[mysite.com...]

I got a mod rewrite for this which convert url into this
[mysite.com...]

RewriteEngine On
RewriteRule ^([a-z]+)$ user/?P=$1 [NC]

and it works 100% only problem is that i have many directories in my website and say if url is this [mysite.com...] then it also looks for a user.. I want to prevent it..
some one said add this.. in condition.. RewriteCond $1!-d

i did this but still not working.. please suggest me what to do.

Thanks,

Moazam

jdMorgan

9:28 pm on Oct 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This RewriteCond might work better:

RewriteCond %{REQUEST_FILENAME} !-d

You *may* be able to use $1 in the RewriteCond, as you posted above, but you'd probably need to prepend "%{DOCUMENT_ROOT}/" to it.

Jim

[edited by: jdMorgan at 9:29 pm (utc) on Oct. 23, 2006]

jcodemasters

9:50 am on Oct 27, 2006 (gmt 0)

10+ Year Member



hi,
can you tell me what should be the code if i mod rewrite will not work for following directories
[sitename.com...]
[sitename.com...]
[sitename.com...]

and redirect all urls containing this www.sitename.com/user/?P=#*$!xx to www.sitename.com/#*$!xx

In my first post this one works fine www.sitename.com/user/?P=#*$!xx but directory condition is not working.

Thank you.