Jump to content

rewrite domain.com/ to domain.com/home


Revlet

Recommended Posts

I searched, I went through rewrite guides, and yet I still could not make this work.

 

I want my website, http://www.professionalteethcleaning.com/ to automatically amend ".com/home" to all incoming traffic that come in as just ".com/"

 

I tried to make this work with "RewriteRule ^/$ http://www.professionalteethcleaning.com/home$ [R]" (rewrite engine is on earlier in htaccess) but I couldn't get it to work despite trying variations.

 

I am not sure if I need a condition or if my rule is wrong, but if someone could help me out I would really appreciate it. I am a html/css/php guy so this is very foreign to me.

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/184837-rewrite-domaincom-to-domaincomhome/
Share on other sites

Oh, and this is my current .htaccess file:

 

DirectoryIndex index.php offline.html

RewriteEngine on
Options FollowSymLinks

RewriteCond %{HTTP_HOST} !^www.professionalteethcleaning.com$
RewriteRule ^(.*)$ http://www.professionalteethcleaning.com/$1 [R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ index.php?p=$1& [L,NC]

# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml

<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|gz|jgz)$">
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
</FilesMatch>

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.jgz -f
RewriteRule (.*)\.js$ $1\.js.jgz [L]
AddType "text/javascript" .js.jgz
AddEncoding gzip .jgz

FileETag none

That was my .htaccess without the line of code (since it didn't work i took it out....i put the whole code there for reference in case something was conflicting with my amateur apache coding)

 

 

Your code works beautifully by the way, thank you. I appreciate it  ;)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.