I have issues configuring mod_rewrite for a website with this setup, Website has a root installation for main language. http://www.domain.com --> Main language (Lang 1). And http://www.domain.com/lang2 --> Secondary language (Lang 2) installed within a sub directory.
I have been able to successfully re-write urls for the main language using this simple line,
RewriteRule ^([a-z_-]+) index.php?page=$1 [NC,L]
But I can't quite figure it out for the sub directory (Lang 2).
Lang 2 has same URL setup. (index.php?page=some-page
This doesn't work ,
RewriteRule ^lang2/([a-z_-]+) lang2/index.php?page=$1 [NC,L]
You have to swap your two rules and use a RewriteBase
.
Replace your current code by this one
RewriteEngine On
RewriteBase /
RewriteRule ^lang2/([^/]+)$ lang2/index.php?page=$1 [L,NC]
RewriteRule ^([^/]+)$ index.php?page=$1 [L,NC]
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.