سؤال

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