首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >page?page= .htaccess

page?page= .htaccess
EN

Stack Overflow用户
提问于 2015-05-08 17:30:43
回答 1查看 84关注 0票数 1

如何设置med文件,使其重写www.mydomain.com/index.php?.htaccess =home to www.mydomain.com/home?

我试过这段代码,但它不是我想要的。

代码语言:javascript
复制
     RewriteEngine On         RewriteBase /
代码语言:javascript
复制
    # 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]

EN

回答 1

Stack Overflow用户

发布于 2015-05-08 17:41:10

你的第一条重定向规则不正确。您可以使用:

代码语言:javascript
复制
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]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30120392

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档