Forum Moderators: phranque
We are having problems with the new written URL.
A link to our rewritten URL:
http://www.example.com/1/title-page.htm
works fine, and display the correct page, but the rewritten URL is changed to the form:
http://www.example.com/content/index.php?action=detailfo&rec=1
Hereīs our htaccess configuration, thats itīs working fine in other servers.
---------------------------
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} .
Rewritecond %{HTTP_HOST} ^example\.com
Rewritecond %{QUERY_STRING} ^(.*)$
RewriteRule ^(.*)$ http://www.example.com/$1?%1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*).htm$ http://www.example.com/$1/index.php?action=$2&$3=$4&$5=$6&$7=$8&$9=$10 [L,QSA]
---------------------------
Thank you.
[edited by: jdMorgan at 2:31 pm (utc) on Feb. 6, 2008]
[edit reason] example.com [/edit]
The closest you can get to a working single rule --with the given limit of 9 variables-- is:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^.]+)\.htm$ /$1/index.php?action=$2&$3=$4&$5=$6&$7=$8 [QSA,L]
Note also that in your first rule (the domain canonicalization redirect), it is unnecessary to take steps to 'carry forward' the query string -- It will pass through the RewriteRule unmodified by default. Therefore, your second RewriteCond is not needed, and you may remove "?%1" from the RewriteRule substitution URL.
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim