1
如何創建.htaccess
將短鏈接重定向到html文件的文件?例如,如何創建將短鏈接重定向到html文件的.htaccess文件?
RewriteEngine On
RewriteRule ^/start$ http://www.%{HTTP_HOST}/index.html [L]
上述規則給我一個404 error
。我在主文件夾中有我的index.html
。
如何創建.htaccess
將短鏈接重定向到html文件的文件?例如,如何創建將短鏈接重定向到html文件的.htaccess文件?
RewriteEngine On
RewriteRule ^/start$ http://www.%{HTTP_HOST}/index.html [L]
上述規則給我一個404 error
。我在主文件夾中有我的index.html
。
那是因爲領先的斜線。嘗試:
RewriteEngine On
RewriteRule ^start/?$ /index.html [L]
.htaccess
是每目錄指令和Apache從RewriteRule
URI模式條當前目錄路徑(從而導致斜線)。
感謝您的解釋。愚蠢的錯誤,但多少寶貴:) 有沒有辦法將www.mydomain.pl重定向到www.mydomain.pl/start? – TheKolanN
不客氣,很高興它解決了。 – anubhava