问题
I am using this htaccess rules to create permalinks on the root folder of a domain :
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* ?url=$0 [L,QSA]
Now i want to use the same rules but on a folder inside this website because i want to make it in two different languages. So if i create a folder: example.com/en/ , i want this conditions to apply same as in the root folder for calling links as below but ignoring the first get variable:
example.com/about-us/ || example.com/en/about-us/
回答1:
Try this .htaccess with an additional rule:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[a-z]{2}/(.*)$ ?url=$1 [L,QSA]
RewriteRule .* ?url=$0 [L,QSA]
来源:https://stackoverflow.com/questions/43216671/ignore-first-variable-on-link-using-htaccess-permalinks