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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签)
  • ¥50 sft下载大文阻塞卡死
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失
  • ¥15 springboot+vue 集成keycloak sso到阿里云
  • ¥15 win7系统进入桌面过一秒后突然黑屏
  • ¥30 backtrader对于期货交易的现金和资产计算的问题
  • ¥15 求C# .net4.8小报表工具
  • ¥15 安装虚拟机时出现问题