在.htaccess中,当我浏览时,网址长度会增加

时间:2013-02-04 10:21:07

标签: php apache .htaccess

我的.htaccess文件包含以下代码。当我浏览以下链接时,网址会发生变化,但不会完全取代,而是会将其附加到上一页,例如。如果我的网址说回家,然后我点击一个链接,带我去donordashboard.php,如果我点击另一个链接带我到donor_profile.php网址更改为主页/仪表板,网址将更改为home / dashboard / donar / profileedit / donor。这样长度不断增加。请帮忙。

RewriteEngine On

RewriteRule home home.php
RewriteRule add/blood_bank add_blood_bank.php
RewriteRule add/blood/donar add_as_a_blood_donar.php

RewriteRule dashboard/donor donordashboard.php
RewriteRule profileedit/donor donor_profile.php
RewriteRule add/last/donated/blood add_last_donated_blood.php
RewriteRule change/pwd/donor blood_change_pwd.php
RewriteRule logout common/logout.php

RewriteRule login_bd bdlogin.php
RewriteRule blood_donor_login blood_donor_login.php

2 个答案:

答案 0 :(得分:0)

这一行可能会继续重定向,对吧?

RewriteRule logout common/logout.php

你应该把绝对网址改为

RewriteRule /logout /common/logout.php

您可以尝试添加[R = 301,L]

RewriteRule /logout /common/logout.php [R=301,L]

-

并添加完整绝对网址,因此您的代码将为:

RewriteEngine On

RewriteRule /home /home.php
RewriteRule /add/blood_bank /add_blood_bank.php
RewriteRule /add/blood/donar /add_as_a_blood_donar.php

RewriteRule /dashboard/donor /donordashboard.php
RewriteRule /profileedit/donor /donor_profile.php
RewriteRule /add/last/donated/blood /add_last_donated_blood.php
RewriteRule /change/pwd/donor /blood_change_pwd.php
RewriteRule /logout /common/logout.php

RewriteRule /login_bd /bdlogin.php
RewriteRule /blood_donor_login /blood_donor_login.php

答案 1 :(得分:0)

Options +FollowSymLinks
RewriteEngine On
RewriteBase /facebook_login/

如果文件位于root中,则尝试添加RewriteBase,只需添加/或文件夹路径