嗨一直在尋找年齡,並嘗試了幾個例子,但沒有任何工作。我希望我的URL看起來好像它位於根目錄,而不是買子目錄:HTAccess重寫的網址看起來像根
http://www.example.com/buy/*.html
到
http://www.example.com/*.html
RewriteRule ^buy/(.*)$ $1 [L]
不斷收到頁面無法正常重定向。 @巴拿馬傑克
任何想法謝謝。
的.htaccess
# non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
AddType application/x-httpd-php .html .htm
# rewrite products to root located
RewriteRule ^buy/(.*)$ $1 [L]
# Remove index.php or index.htm/html from URL requests
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.(php|html?)\ HTTP/
RewriteRule ^([^/]+/)*index\.(html?|php)$ http://www.example.com/$1 [R=301,L]
# GZIP
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/x-javascript application/javascript
# Redirect all index calls
RewriteEngine On
RewriteRule ^index\.(php|html?)$ http://www.example.com/ [R=301,L]
#Custom 404 errors
ErrorDocument 404 /productslinks404.html
@Panama更新我的問題。感謝您的時間。 – Barton 2015-02-13 10:47:38