简体   繁体   English

.htaccess 301重定向并删除page.php

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

So my problem is that I have this running in a sub-directory and there are a couple problems... 所以我的问题是我在一个子目录中运行它,并且有几个问题...

  1. When I add the 301 redirect I get a 500 error 当我添加301重定向时,出现500错误
  2. I cannot get "page" removed from the URL ( http://174.136.15.245/~clubz/test/page/about-club-z-tutoring-test ) 我无法从网址( http://174.136.15.245/~clubz/test/page/about-club-z-tutoring-test )中删除“页面”

Here is my code: 这是我的代码:

<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>

I did look through some other solutions here but I still could not get this to function exactly the way I needed. 我确实在这里浏览了其他一些解决方案,但是仍然无法完全按照我需要的方式运行。 Any insight would be appreciated. 任何见识将不胜感激。

Jackpot! 大奖! Well, at least on getting page removed from the URL: 好吧,至少是要从URL中删除页面:

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

The redirect still doesn't work but it would be nice to have. 重定向仍然不起作用,但是很高兴。 For now I'll run with this. 现在,我将使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM