Reputation: 279
I hope someone could advise this is a probably is a easy question but my knowledge of .htaccess is limited.
I have inherited a odd file structure that has dependancies on files from a previous install.
Below is a spseudo file structure which mirrors what I have on a sub-domain.
+site-directory
index.html
file.php
another-file.php
+ other-folder
display.php
The sub domain site directory is:
/site-directory
I want to access the sub domain from the main domain from the following url:
/site-directory/other-folder/display.php
the problem I am having is if you put www.subdomainurl.com in the browser the previous install is displayed.
How can I stop this and only access the sub doamin via
/site-directory/other-folder/display.php
I have blocked indexing from robots.txt
What would be best practices for this situation?
Thanks in advance
Upvotes: 1
Views: 369
Reputation: 784878
Question is not very clear to me, so my answer is based on some assumptions.
Enable mod_rewrite and .htaccess through httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?subdomainurl\.com$ [NC]
RewriteRule ^$ /other-folder/display.php [R=302,L]
Upvotes: 1