문제

Currently on my website when a user logs it it shows www.domain.com/userHome.php and I want it to just show www.domain.com so I can have a cleaner url for the user to see.

I had trouble figuring out how to get the url rewrite to just chomp off the end in the address bar. I was following a tutorial here, and decided to try this in my .htaccess file to see if I could get any rewrite working.

RewriteEngine on
RewriteRule ^userHome.php$ /hello.html

when I tried this I was expecting to see www.domain.com/hello.html instead of www.domain.com/userHome.php which isn't exactly what i wanted but I am trying to take baby steps as I learn this.

Unfortunetley when I tried this I just got a page not found error when I went to www.domain.com/userHome.php

도움이 되었습니까?

해결책

Try:

RewriteRule ^hello\.html$  userHome.php [L]

Then try to access: www.domain.com/hello.html

다른 팁

You really don't need to use mod rewrite for this. Just use:

DirectoryIndex userHome.php index.php index.html index.htm
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top