Ignore first variable on link using HTACCESS perma

2019-09-15 18:49发布

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条回答
啃猪蹄的小仙女
2楼-- · 2019-09-15 19:33

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]
查看更多
登录 后发表回答