3

I had a paid domain, I did put a folder with the name of the domain (mysite.net) in the server

I don't want to pay for the domain anymore, so I want to use the default subdomain given by my hosting service (mysitenet.ipage.com) but the problem is what I said above, it exists a folder with the name of my paid domain, like this:

/
  /mysite.net
  /cgi.bin

I read this solution to try redirection:

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !^/mysite.net[NC]
RewriteRule ^ /mysite.net%{REQUEST_URI} [R=301,L]

with this rules I go to mysitenet.ipage.com and redirects me to mysitenet.ipage.com/mysite.net as I want, but is there a way to hide the 'mysite.net' part?

Community
  • 1
  • 1
Naty Bizz
  • 1,881
  • 5
  • 28
  • 47

1 Answers1

1

You can put this code in your htaccess (which has to be in root folder)

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

RewriteRule ^(?!mysite\.net/)(.*)$ mysite.net/$1 [L,QSA]

EDIT: if you want to avoid duplicate content and also redirect /mysite.net/something to /something

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/mysite\.net/([^\?\s]+) [NC]
RewriteRule ^ %1 [R=301,L]

RewriteRule ^(.*)$ mysite.net/$1 [L,QSA]
Justin Iurman
  • 18,312
  • 3
  • 30
  • 48