Rewrite Condition Not Working! Help Needed PLZ!

Hi, im totally new to Mod Rewriting but ive been gettin away with the available scripts online so far with my website. The problem has arisen with existing directories on my server and i just cant get Apache to ingore the rule when it comes to a valid directory!! Iv searched online extensively but cannot seem to find a solution so have signed up here to ask here in the forums. So far ive been gettin away with it through the use of include scripts inside the main space.php file that ive been using to redirect all links. This has become troublesome and buggy since the list of valid directories has grown… So i really need some help!!
Thanx guys!!

Problem:” Redirects successfully as “
However, existing directory “” cannot be reached, as it is redirected to “” rewritten as “

# My apache script
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)$ space.php?user=$1&%{QUERY_STRING} [L]
RewriteRule ^([a-zA-Z0-9_-]+)/$ space.php?user=$1&%{QUERY_STRING} [L]

QUESTION: Why doesnt the -d condition work??? :frowning:

Additionally, im trying to erase multiple dynamic urls of a single page from search engines by getting rid of the query string from external requests through this:

RewriteCond %{THE_REQUEST} ^GET\\ /.*\\;.*\\ HTTP/
RewriteCond %{QUERY_STRING} !^$
RewriteRule .*{REQUEST_URI}? [R=301,L]

But it doesnt work either! As im able to directly access

Please help. Many thanks in advance!


Have you searched here? Have you read the sticky posts and their referenced links? Naw, obviously not!

Anyway, the problem is that a RewriteCond only applies to the mod_rewrite block statement it’s associated with (before the next Last flag).

Go ahead and have a read of the tutorial linked in my signature. It’s been developed to include the best of many threads and it HAS helped MANY members.



Why have you got a link in your article that leads to a page that throws a FORBIDDEN error?? Lol. And besides, it’s such a small script you couldv just given me the script as it should be rather than tellin me to search the forums. I have searched! I don’t understand it all that’s what I’m tellin you and that is exactly the reason why I’ve posted for help. Your not obliged to help, but I’m not obliged to learn everything prior to asking for help am I? I don’t know hence why I asked. Nevermind.

# RewriteCond %{THE_REQUEST} ^GET\\ /.*\\;.*\\ HTTP/
# What do you think you need this for?
RewriteCond %{QUERY_STRING} !^$
RewriteRule .*{REQUEST_URI}? [R=301,L]

Without the first condition the GET variables are lost. They are not passed on to the next page via the page?variable=value declaration. WITH the statement above, its passed. but the query string is not removed.


if i didnt want the query string to be visible. i would simply REMOVE get variables from my urls! Why would i bother using an apache directive to remove them while stupidly keeping the url with get variables in them???

You really have an attitude problem dont you?

And for the record I DID READ THAT ARTICLE prior to asking the above question: Check your server access logs for my IP number! There is nothing in that article which deals with my question above! Not in any way that i can benefit from it atleast, with my minimum knowledge of Apache. I should not have bothered with this forum in the first place.

While the response to your first post did seem a bit overly RTFM centric (it did seem like you’ve been trying), the best thing to do would have been to take a breather and move on to explaining it, or just keeping us updated on what you’ve been trying and confusions along the way.

I really see no reason why your third post, following a day after the second post was still so high strung. Or at the very least, that’s how it read on my end.

So breathe.