- Apr 12, 2001
- 4,508
- 0
- 76
This question is for any other Apache users and administrators here.
I'm having some trouble with mod_rewrite. I have some conditions and rules already set and working, but this new one isn't doing that I want. I am trying to make it so anyone coming in via port 443 (SSL) can only view specific parts of the site via SSL. If they are not attempting to go to specific folders, then mod_rewrite will push them back out to the standard port 80 connection.
Here is a sample of my config:
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/ecom/
RewriteRule ^/(.*) http://www.my.domain/$1 [L,R]
Basically what it does here is first checks the condition that the user is in fact using port 443. Then it checks if they are NOT in the /ecom/ folder. If both conditions are true, then it will rewrite the URL back to the main site. The reason I check for the /ecom/ folder is because that is the only subfolder on the server that I currently want to allow SSL connections. I may add more folders later, but for that is the only one.
In practice though it does NOT do what it is supposed to. I have tried a few different approaches, but they don't work.
Any suggestions?
I'm having some trouble with mod_rewrite. I have some conditions and rules already set and working, but this new one isn't doing that I want. I am trying to make it so anyone coming in via port 443 (SSL) can only view specific parts of the site via SSL. If they are not attempting to go to specific folders, then mod_rewrite will push them back out to the standard port 80 connection.
Here is a sample of my config:
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{REQUEST_URI} !^/ecom/
RewriteRule ^/(.*) http://www.my.domain/$1 [L,R]
Basically what it does here is first checks the condition that the user is in fact using port 443. Then it checks if they are NOT in the /ecom/ folder. If both conditions are true, then it will rewrite the URL back to the main site. The reason I check for the /ecom/ folder is because that is the only subfolder on the server that I currently want to allow SSL connections. I may add more folders later, but for that is the only one.
In practice though it does NOT do what it is supposed to. I have tried a few different approaches, but they don't work.
Any suggestions?