【问题标题】:mod_rewrite rule to change URL修改 URL 的 mod_rewrite 规则
【发布时间】:2014-01-29 09:31:25
【问题描述】:

如何在文件 .htaccess 中创建重写规则来更改此 URL:

http://www.benessereglobale.net/beta/shtml/home.shtml

进入这个:

http://www.benessereglobale.net/home.shtml

谢谢

【问题讨论】:

  • RewriteBase 上的 RewriteEngine /base RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule /beta/(.*) /beta/shtml/$1 [ L] RewriteRule /beta/shtml/(.*) /beta/$1 [L,R=302]

标签: html apache .htaccess url mod-rewrite


【解决方案1】:

怎么样:

RewriteEngine On
RewriteRule ^home.shtml$ /beta/shtml/home.shtml [L,R=301]

【讨论】:

    【解决方案2】:

    将此代码放入您的DOCUMENT_ROOT/.htaccess 文件中:

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /beta/shtml/$1 [L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-05
      • 1970-01-01
      • 2014-05-04
      • 1970-01-01
      • 2012-07-23
      • 2020-11-25
      • 1970-01-01
      相关资源
      最近更新 更多