对于这个网站www.demoeial.be,我使用URL重写每个链接。这是文章的重写规则:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^artikels/([0-9]+)/(.*).dhtml http://www.demoeial.be/articles.php?article_id=$1 [NC]
RewriteRule ^prints/([0-9]+)/(.*).dhtml http://www.demoeial.be/print.php?action=view&print_id=$1 [NC]
RewriteRule ^auteur/([0-9]+)/([0-9]+)/(.*).dhtml http://www.demoeial.be/author.php?action=view&author_id=$1&page=$2 [NC]
RewriteRule ^nieuws/([0-9]+)/$ category.php?cat_id=1&page=$1
RewriteRule ^dossiers/([0-9]+)/(.*)/([0-9]+)/$ dossiers.php?dossier_id=$1&page=$3
RewriteRule ^interviews/([0-9]+)/$ category.php?cat_id=4&page=$1
RewriteRule ^reportages/([0-9]+)/$ category.php?cat_id=5&page=$1
RewriteRule ^cultuur/([0-9]+)/$ category.php?cat_id=6&page=$1
RewriteRule ^opinie/([0-9]+)/$ category.php?cat_id=2&page=$1
RewriteRule ^satire/([0-9]+)/$ category.php?cat_id=7&page=$1
RewriteRule ^politiek-filosofie/([0-9]+)/$ category.php?cat_id=8&page=$1
RewriteRule ^literair/([0-9]+)/$ category.php?cat_id=9&page=$1
RewriteRule ^muziek/([0-9]+)/$ category.php?cat_id=10&page=$1
RewriteRule ^meewerken/$ content.php?content_id=2
RewriteRule ^over/$ content.php?content_id=1
RewriteRule ^zoeken/(.*)/([0-9]+)/$ search.php?search_words=$1&page=$2
RewriteRule ^print/([0-9]+)/$ print.php?page=$1
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css text/javascript application/x-javascript application/javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
</IfModule>
以前工作过,但是有一段时间浏览器显然被重定向到服务器链接。例如,http://www.demoeial.be/artikels/10436/Studentenoverleg-VGC-levert-weinig-op.dhtml转到http://www.demoeial.be/articles.php?article_id=10436。之前它从未表现出第二个环节,并不断展现出好看的一个。我不知道发生了什么或发生了什么变化,但它之前有效。任何猜测?
提前致谢。
答案 0 :(得分:0)
我怀疑之前是否正常工作。替换URL中以http://
开头的规则会创建重定向。更改此规则:
RewriteRule ^artikels/([0-9]+)/(.*).dhtml http://www.demoeial.be/articles.php?article_id=$1 [NC]
对此:
RewriteRule ^artikels/([0-9]+)/(.*).dhtml articles.php?article_id=$1 [NC]