我的.htaccess没有重定向到友好的网址

时间:2015-10-10 09:02:23

标签: php .htaccess

以下是我的.htaccess文件。它不起作用。

RewriteEngine On           RewriteBase /

      RewriteCond %{REQUEST_FILENAME} -f [OR]
      RewriteCond %{REQUEST_FILENAME} -d 
      RewriteCond %{REQUEST_FILENAME}\.php -f
      RewriteRule ^ - [L]

      RewriteRule ^friends/([\w-]+)/?$ /friends.php?username=$1 [L,QSA]
      RewriteRule ^followers/([\w-]+)/?$ /followers.php?username=$1 [L,QSA]
      RewriteRule ^settings/([\w-]+)/?$ /settings.php?username=$1 [L,QSA]
      RewriteRule ^messages/([\w-]+)/?$ /chat.php?message_username=$1 [L,QSA]

      RewriteRule ^following/([\w-]+)/?$ /following.php?username=$1 [L,QSA]
      RewriteRule ^following/([\w-]+)/([0-9]+)/?$ /following.php?username=$1&page=$2 [L,QSA]
      RewriteRule ^followers/([\w-]+)/?$ /followers.php?username=$1 [L,QSA]
      RewriteRule ^followers/([\w-]+)/([0-9]+)/?$ /followers.php?username=$1&tpage=$2 [L,QSA]
      RewriteRule ^explore/([\w-]+)/?$ /explore.php?username=$1 [L,QSA]
      RewriteRule ^explore/([\w-]+)/([0-9]+)/?$ /explore.php?username=$1&page=$2 [L,QSA]
      RewriteRule ^photos/([\w-]+)/?$ /userphotos.php?username=$1&page=$2 [L,QSA]

      RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ /profile.php?username=$1 [L,QSA]

0 个答案:

没有答案