I am trying to make a redirect from a request like [http://test.site.com/ pagename--city /] to something like [http://test.site.com/ state/pagename--city /] and then back to [http://test.site.com/pagename--city/]. The 'state/pagename--city' are physical directories on the server. So if someone clicks on [http://test.site.com/pagename--city/] I need to execute [http://test.site.com/state/pagename--city/index.php] but the URL to remain [http://test.site.com/pagename--city/]. Any help appreciated. Thnx.
.htaccess file
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} /(.*)--(.*)/?$
RewriteCond %{REQUEST_URI} !/state/
RewriteRule .* http://%{HTTP_HOST}/state%{REQUEST_URI} [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* page.php?&[|]v1||%{REQUEST_URI}[|]v2||-[|]v3||%{HTTP_HOST}[|]v4||%{REQUEST_FILENAME}[|]v5||EOL[~|~]= [QSA,L]
RewriteRule ^(.*)--(.*)$ /state/$1--$2/index.php&%{QUERY_STRING} [L]
不是很清楚,这是您要找的东西吗?
RewriteRule ^([^-]+)--(.+)$ /state/$1--$2/index.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.