开发者

htaccess works but content doesn't load

When I use index.php?id=this-is-an-article the page loads with the content, when I use /articles/this-is-an-article the page loads without any content, any idea as to how I can resolve this?

.htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# force www. in all requests
RewriteCond %{HTTP_HOST} ^mysite\.net [NC]
RewriteRule ^(.*)$ http://www.mysite.net/$1 [L,R=301]

# enable hiding php exte开发者_C百科nsion
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^(.*)\$ $1.php

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  
RewriteRule ^page/(\d+)*$ ./index.php?p=$1  

# index.php?id=this-is-an-article => /articles/this-is-an-article 
RewriteRule /articles/(.*)  index.php?id=$1 [NC,L]

Thanks in advance.


Get rid of the leading slash. It's also best practice to begin a regex like that with ^ and end it with $.

RewriteRule ^articles/(.*)$  index.php?id=$1 [NC,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜