dongyan1808 2017-11-03 15:51
浏览 116
已采纳

使用Wordpress Rewrite或.htaccess重写URL

I'm trying to append to wordpress an additional parameter into my URL. For example, I have the URL: http://example.com I want to change that to URL: http://example.com/this-example/

I'm thinking I can do this is in htaccess along the lines of a rewrite condition, but i'm unsure how to go about this. This is what I was thinking here.

Htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine on
RewriteRule ^/this-example/(.*)/ /index.php?$1 [L]
</IfModule>
Options -Indexes
  • 写回答

1条回答 默认 最新

  • doumeng1089 2017-11-03 19:07
    关注

    You can try this:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{THE_REQUEST} !^/this-example [NC]
        # use your own host here, for me is 192.68.10.10
        RewriteCond %{HTTP_HOST} 192\.168\.10\.10$ [NC] 
        RewriteRule !^this-example/ /this-example%{REQUEST_URI} [L,R,NE]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^this-example/(.*)$ $1 [L,QSA]
    </IfModule>
    
    Options -Indexes
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效