【问题标题】:Want to Change URL from www.domain.com/home to www.domain.com想要将 URL 从 www.domain.com/home 更改为 www.domain.com
【发布时间】:2014-05-07 12:19:46
【问题描述】:

这是我的.htaccess 代码:

AddHandler x-httpd-php5-3 .php 重写引擎开启 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}/index.html !-f RewriteCond %{REQUEST_FILENAME}/index.php !-f 重写规则。索引.php [L] RewriteCond %{THE_REQUEST} /welcome/[/?\s] [NC] 重写规则 ^ / [R=301,L]

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    您可以在 root .htaccess 中使用此规则:

    AddHandler x-httpd-php5-3 .php  
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{THE_REQUEST} /welcome[/?\s] [NC]    
    RewriteRule ^ / [R=301,L]    
    
    RewriteCond %{REQUEST_FILENAME} !-f  
    RewriteCond %{REQUEST_FILENAME}/index.html !-f  
    RewriteCond %{REQUEST_FILENAME}/index.php !-f  
    RewriteRule . index.php [L]
    

    【讨论】:

    • 不走运先生。我试过了。这是我的页面名称,具有规范的 URL。整个页面都使用规范 URL,但在主页上我只想删除 /welcome
    • 什么???你的问题说你想删除/home,现在你说的是/welcome。您尝试的完整 URL 是什么?这个 .htaccess 的位置是什么?
    • 好的,我将在根文件夹中向您发送我的 htaccess 代码
    • 再次阅读我的评论,看看您是否回答了我的两个问题。
    • 是的,先生,我知道您已经回复了 /home,但在放置代码时,我将其更改为 /welcome。您现在可以看到我的问题包含我的 htaccess 代码。
    猜你喜欢
    • 2014-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-23
    • 2014-01-21
    • 1970-01-01
    • 1970-01-01
    • 2019-07-08
    相关资源
    最近更新 更多