Forum Moderators: phranque
I'm trying to set my site up on my local machine using the following rules (which is taken from my live site, which works fine on the domain).
-----------------------------------------------------------------
RewriteEngine on
#
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com(:[0-9]+)?$
RewriteRule (.*) [localhost...] [R=301,L]
#
RewriteRule ^([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/?$ /index.php?$1=$2&$3=$4&$5=$6&$7=$8&$9=$10 [L]
#
RewriteRule ^([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/?$ /index.php?$1=$2&$3=$4&$5=$6&$7=$8 [L]
#
RewriteRule ^([^_]+)_([^/]+)/([^_]+)_([^/]+)/([^_]+)_([^/]+)/?$ /index.php?$1=$2&$3=$4&$5=$6 [L]
#
RewriteRule ^([^_]+)_([^/]+)/([^_]+)_([^/]+)/?$ /index.php?$1=$2&$3=$4 [L]
#
RewriteCond $1 !^noexist$
RewriteRule ^([^_]+)_([^/]+)/?$ /index.php?$1=$2 [L]
-----------------------------------------------------------------
When I use the above, I get the error "The page isn't redirecting properly". I'm not sure what I should be putting in the "RewriteCond %{HTTP_HOST} !^www\.mydomain\.com(:[0-9]+)?$" line for localhost.
Any ideas? I'm at a loss
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^localhost\.?(:[0-9]+)?$
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
As for your rewrite/redirect to /test/myfolder, that should be handled in your local server configuration. That is, define DocumentRoot for your test domain to point to /test/myfolder, avoiding any need for a rewrite or redirect to /test/myfolder, and eliminating all the related complications.
Jim
[edited by: jdMorgan at 2:13 pm (utc) on April 18, 2008]