Subfolder .htaccess not found

时间:2015-07-08 15:46:32

标签: php regex apache .htaccess mod-rewrite

Hi friends i am getting this error anyona cen tell me how can i fix this error. The htaccess my htaccess file is this:

#Options +FollowSymLinks -MultiViews
#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 ^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]

Not Found

The requested URL /profile/following/demo was not found on this server.

Apache/2.2.15 (CentOS) Server at prototype.kofendurance.com Port 80

Also i am getting same error all htaccess RewriteRule.

1 个答案:

答案 0 :(得分:1)

跳过文件或目录的第一条规则不正确,您需要取消注释开头行:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /profile/

# skip real files and directories from all the rules
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# rest of the rules