0

normal condition
redirect to "http://www.domain.com" when just type "domain.com"

we can use like below on .htaccess file

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
RewriteRule ^$ http://www.domain.com/index.php [L,R=301]

================================================================= if anyone know when use append folder to be a website ? how to set rule on .htaccess?

if i want to just type "domain.com/uat_01" hope redirect to "http://www.domain.com/uat_01" or "http://www.domain.com/uat_01/index.php"

hchang909
  • 7
  • 2
  • You don't need to worry about rewriting the HTTP bit - when they request `domain.com/uat_01` it *must* be over HTTP (or HTTPS) already. I think all you need to rewrite is forcing the `www` to display? See [this answer](http://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way) for how to do that. – samiles Oct 27 '16 at 14:06
  • RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] – Weenesta - Mathieu Dormeval Oct 27 '16 at 14:06
  • you totally help my perfect to solve my problem !! the code is so beauty and clean!! – hchang909 Oct 28 '16 at 02:45

0 Answers0