Forum Moderators: phranque
This currently gives an Internal Server Error(500).
RewriteEngine On
RewriteCond %{HTTP_HOST} sub\.domain\.com
RewriteCond %{REQUEST_URI}!^sub/
RewriteRule ^([A-Za-z]+)?/?([A-Za-z]+)?/?([A-Za-z]+)?/? /sub/index.php?1=$1&2=$2&3=$3 For reference: my subdomain was made with cPanel, and my .htaccess is placed in my public_html folder.
Welcome to WebmasterWorld!
The critical problem is in your second RewriteCond. The REQUEST_URI is the entire URL path requested by the client, not the local URL-path "seen" by RewriteRule. Therefore, it must start with a slash. Since you don't have a slash, it will never match, and the rewrite will be invoked repeatedly, adding "/sub" to the URL again and again, until the server reaches its maximum internal redirection limit.
RewriteEngine On
RewriteCond %{HTTP_HOST} sub\.domain\.com
RewriteCond %{REQUEST_URI} !^/sub/
RewriteRule ^([a-z]+)?/?([a-z]+)?/?([a-z]+)?/? /sub/index.php?1=$1&2=$2&3=$3 [NC,L]
If you still have problems, examine your server error log; It often will tell you exactly what is wrong.
Jim