简体   繁体   English

.htaccess www.mydomain.com/index.php?page=home到www.mydomain.com/home

[英].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.

相关问题 如何在 PHP 中将 www.mydomain.com/page/user/756890 转为 www.mydomain.com - How to turn www.mydomain.com/page/user/756890 to www.mydomain.com in PHP 需要使用 www.mydomain.com/filename/ 而不是 www.mydomain.com/file.php?id=1 - need to use www.mydomain.com/filename/ instead of www.mydomain.com/file.php?id=1 从www.mydomain.com/foo重定向到www.mydomain.com/foo/ - Redirect from www.mydomain.com/foo to www.mydomain.com/foo/ Laravel 4.1使用301永久重定向将所有请求从www.mydomain.com重定向到mydomain.com - Laravel 4.1 Redirect all requests from www.mydomain.com to mydomain.com with 301 permanent redirect 只允许PHP脚本打开网址,如www.mydomain.com/topsecret/1/001.jpg - only allow PHP scripts to open urls like www.mydomain.com/topsecret/1/001.jpg 网址重写:将mydomain.com/index.php更改为mydomain.com/home - URL rewriting: Change mydomain.com/index.php to mydomain.com/home Yii ::将www.domain.com/index.php重定向到www.domain.com,而不使用htaccess - Yii:: redirect www.domain.com/index.php to www.domain.com without using htaccess 仅将htaccess主页https://a.com重定向到https://www.a.com重定向 - Htaccess only home page https://a.com to https://www.a.com redirect Htaccess URL将www.website.com/info/index.php重写为info.website.com - Htaccess URL rewrite www.website.com/info/index.php to info.website.com 使用htaccess将网址www.xyz.com/index.php?id=xyz重写为www.xyz.com/xyz - rewrite url www.xyz.com/index.php?id=xyz to www.xyz.com/xyz using htaccess
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM