Reputation: 683
I'll try to explain as best as I can, but I don't fully understand what it is that I'm doing. I have Googled around, and read some information, but at this point I need someone to just give me a kick in the butt and show me what it is that I'm doing wrong.
Here is an htaccess script that changes ?page=home&subcat=about&category=me
into /home/about/me/
.
RewriteRule ^([a-zA-Z0-9]+)/?$ index.php?page=$1 [NC]
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ index.php?category=$1&page=$2 [NC]
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ index.php?category=$1&subcat=$2&page=$3 [L,NC]
(this works just as it's supposed to)
Now, I have a sub-domain, let's call it sublevel.mywebsite.com
that points to mywebsite.com/myfolder
If I go to sublevel.mywebsite.com
it will act as if /myfolder/
is ?page=myfolder
- I do not want this for the subdomain, only for the normal site.
I tried adding a redirect condition in front like this:
RewriteCond %{REQUEST_URI} !^/myfolder$
But, it doesn't seem to be changing very much.
I don't understand what else I can do here, but any help is appreciated? I would also appreciate a small explanation on what is happening if that's possible.
Upvotes: 1
Views: 25
Reputation: 41219
This is happening because you are rewriting all requests to /index.php, To exclude the subdomain redirection, add the following rule above your RewriteRules :
RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
RewriteRule ^ - [L]
Upvotes: 1