samedi 21 avril 2018

.htaccess not working properly. I want subdomain to be maintained in the url

I am running a website via FTP server.

I am going to revamp this website that is made by someone else.

What I want to do is move the website to the subdomain archive.domain.com.

I copied all my files into a subfolder called archive/ and all the functions seem working.

However, when I access to http://archive.example.com/some_page, it automatically redirects to http://www.example.com/archive/some_page which is not what I wanted.

I want the domain always to be displayed as archive.example.com.

Because if I click the hyperlinks on the webpage, which is relative, it is redirected to the root directory. Say, if I click /other_page, it goes to http://www.example.com/other_page, not http://archive.example.com/other_page.

How can I do this?

My current .htaccess file looks like this.

RewriteEngine On  

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f   

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

RewriteRule ^some_page$ /some_page/ [R]
RewriteRule ^some_page/$ ./some_page.php

Thank you very much!

Aucun commentaire:

Enregistrer un commentaire