문제

How to create .htaccess file that redirect short links into html files? Eg.

    RewriteEngine On
    RewriteRule ^/start$ http://www.%{HTTP_HOST}/index.html [L]

The above rule gives me a 404 error. I have my index.html in the main folder.

도움이 되었습니까?

해결책

That is because of leading slash. Try this:

RewriteEngine On
RewriteRule ^start/?$ /index.html [L]

.htaccess is per directory directive and Apache strips the current directory path (thus leading slash) from RewriteRule URI pattern.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top