我使用.htaccess創建乾淨的網址。 這裏是一片.htaccess文件的:乾淨的URL與.htaccess但只有一個網址
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
RewriteRule ^posts/page/([0-9]+)/$ posts.php?page=$1
RewriteRule ^posts posts.php
它工作正常,但問題是這兩個URL工作! 有沒有辦法只做site.com/posts/工作,並在site.com/posts.php上返回'not found'(或重定向到site.com/posts/)
想想我讀了兩處地址對於相同的頁面對於seo不利。
now/posts/returns 404 too。無論如何,只有使/posts.php返回404? – theboy