下面給出的是我的.htaccess文件。它不工作在本地主機上的Apache(www是在C盤根目錄:/阿帕奇/ WWW)「網址」是目錄,我想這樣的新格式的網址
http://localhost/url/index.php?username=shah 到 http://localhost/url/shah
更改Windows主機文件127.0輸出.0.1本地主機 &也使mod_rewrite的在httpd.conf文件&的AllowOverride無人的AllowOverride所有 &根目錄爲C:/阿帕奇/ WWW
//==============================HTaccess==================================//
Options:
# -MultiViews: Turns off multiviews so it doesn't interfer with our rewrite rules
# -Indexes: Stop directory listings
# +FollowSymlinks: Let out rewrite rules work
Options -MultiViews -Indexes +FollowSymlinks
<IfModule mod_security.c>
# Turn off mod_security filtering.
# SecFilterEngine Off
# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
ErrorDocument 404 /url/404.php
<IfModule mod_php5.c>
php_value register_globals 0
php_value magic_quotes_gpc 0
php_value session.auto_start 0
php_value safe_mode 0
</IfModule>
<IfModule sapi_apache2.c>
php_value register_globals 0
php_value magic_quotes_gpc 0
php_value session.auto_start 0
php_value safe_mode 0
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /url/
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?username=$1
#RewriteRule ^view-content/([^/]*)/([^/]*)\.html$ content.php?pageid=$1&title=$2 [L]
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>
//==============================HTaccess==================================//
請告訴我該怎麼做?
你能解釋一下哪些工作不正常嗎?它只是RewriteRule還是整個.htaccess文件被忽略? – clmarquart 2011-04-05 12:56:07
請看下面的回答 – user692487 2011-04-06 06:08:07