[英].htaccess www.mydomain.com/index.php?page=home to www.mydomain.com/home
how do I setup med .htaccess file, so it will rewrite www.mydomain.com/index.php?page=home to www.mydomain.com/home? 如何设置med .htaccess文件,以便将www.mydomain.com/index.php?page=home重写为www.mydomain.com/home?
I have tried this piece of code, but it doesn't like i want. 我已经尝试过这段代码,但是不喜欢我想要的。
RewriteEngine On RewriteBase / 在RewriteBase上的RewriteEngine /
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php?page= [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule ^([^/]+)/? index.php [L,QSA]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?page=$1 [L]
Your first redirect rule in not right. 您的第一个重定向规则不正确。 You can use:
您可以使用:
RewriteEngine On
RewriteBase /
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} /index\.php\?page=([^\s&]+) [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule ^ /%1? [R=302,L,NE]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?page=$1 [L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.