【问题标题】:mod_rewrite the page name towice when i click on link当我单击链接时,mod_rewrite 页面名称两次
【发布时间】:2014-11-18 03:07:35
【问题描述】:

当我启用 mod_rewrite 时,当我第二次单击链接时,它会正常工作,页面名称显示在 url twicw 中,例如:/secure/UITA/video/video/showlibrary/1/4/4 视频是我的 php 页面

请给我解决办法

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+video\.php\?task=([^\s&]+) [NC]
RewriteRule ^ video/%1? [R=302,L]
RewriteRule ^video/([\w-_:]+)/?$ video.php?task=$1 [L,NC,QSA]

RewriteCond %{THE_REQUEST} \s/+video\.php\?task=([^\s&]+)&vendorid=([^&]*)&certid=    ([^&]*)&examid=([^&]*) [NC]
RewriteRule ^ video/%1/%2/%3/%4? [R=302,L]
RewriteRule ^video/([\w-_:]+)/([0-9]+)/([0-9]+)/([0-9]+)?$ video.php?task=$1&vendorid=$2&certid=$3&examid=$4 [L,NC,QSA]


# PHP hiding rule

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]

【问题讨论】:

  • 这与重写规则无关。您需要确保使用绝对 URL,例如 href="/video/showlibrary/1/4/4"

标签: php linux apache .htaccess mod-rewrite


【解决方案1】:

将此添加到页面标题:

<base href="/" />

【讨论】:

    猜你喜欢
    • 2016-11-28
    • 2020-04-21
    • 1970-01-01
    • 2011-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-13
    • 1970-01-01
    相关资源
    最近更新 更多