簡體   English   中英

.htaccess 301重定向並刪除page.php

[英].htaccess 301 redirect and remove page.php

所以我的問題是我在一個子目錄中運行它,並且有幾個問題...

  1. 當我添加301重定向時,出現500錯誤
  2. 我無法從網址( http://174.136.15.245/~clubz/test/page/about-club-z-tutoring-test )中刪除“頁面”

這是我的代碼:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    # RewriteRule (.*) http://174.136.15.245/~clubztutors/test/ [R,L]

    RewriteBase /~clubz/test/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # RewriteRule ^(.*)$ page.php?/$1 [R=301, L]
    # RewriteRule ^page.php?p=$1 page/([^/.]+)/?$ [R=301, L]
    # This works but add "page" directory
    RewriteRule ^page/([^/.]+)/?$ page.php?p=$1 [L]
</IfModule>

我確實在這里瀏覽了其他一些解決方案,但是仍然無法完全按照我需要的方式運行。 任何見識將不勝感激。

大獎! 好吧,至少是要從URL中刪除頁面:

RewriteRule ^([^/.]+)/?$ page.php?p=$1 [L]

重定向仍然不起作用,但是很高興。 現在,我將使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM