我遇到了麻煩,因爲我想我的網址SEO友好。而這一切都很好,但我不能在URL中去,而無需使用.PHPhtaccess mod_rewrite沒有.php
我的網址是:
http://rasolutions.eu/blogitem?id=3
而且我希望它是:
http://rasolutions.eu/blogitem/3/
我搜索在線和我編寫的代碼,使它的工作,唯一的問題是,我不能去的URL,除非我使用.php 我的htaccess代碼是這樣的(我是一個noob,如果涉及htaccess的話):
ErrorDocument 404 /404.php
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# WWW to not WWW.
RewriteCond %{HTTP_HOST} ^www\.rasolutions\.eu$
RewriteRule ^/?$ "http\:\/\/rasolutions\.eu\/" [R=301,L]
# No PERL access/
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* – [F,L]
RewriteEngine On
RewriteRule ^blogitem/([0-9]+)/$ blogitem.php?id=$1 [NC,L]
RewriteEngine On
RewriteRule ^blog/([0-9]+)/$ blog.php?page=$1 [NC,L]
# Home redirect.
DirectoryIndex home.php
非常感謝您的幫助!對不起英文不好,這不是我的母語。
您可以刪除第二和第三'RewriteEngine敘述On',因爲它被打開了。 – Howli