: Htaccess issue with URL masking I am attempting to mask an URL using an htaccess file to only show the root URL. This is a Drupal 7 website, so I want the URLs to look like the following:
I am attempting to mask an URL using an htaccess file to only show the root URL.
This is a Drupal 7 website, so I want the URLs to look like the following:
Main page:
www.site1.com Drupal content:
www.site1.com/content/....
There is also a test site that should appear as:
Test site:
www.site1.com/site1-test Test content:
www.site1.com/site1-test/content/...
The directory structure is as follows:
public_html/
|--site1/
|--site1-test/
Here is the htaccess file I've been working on in public_html/.htaccess. It mainly works, however there is a small issue. When I visit site1.com the URL appears as I want, however whenever I click any content it shows site1.com/site1/... instead of hiding the extra subdirectory. This is based on a prior StackOverflow question.
public_html/.htaccess
Options +FollowSymLinks
RewriteEngine on
#========================================================================
# FIRST Handle the http requests first before removing the additional url junk
#========================================================================
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteCond %{REQUEST_URI} !^/site1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site1/
RewriteCond %{HTTP_HOST} ^(www.)?site1.com/site1-test$
RewriteCond %{REQUEST_URI} !^/site1-test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site1-test/
#==========================================================
# SECOND Remove the additional url junk once the new url is loaded
#==========================================================
RewriteCond %{HTTP_HOST} ^(www.)?site1.com$
RewriteRule ^(/)?$ site1/index.php
RewriteCond %{HTTP_HOST} ^(www.)?rg$
RewriteRule ^(/)?$ site1/index.php
Previously I'd updated the $base_url variable in the settings.php file, however that seemed to break my themes unless if I pointed it directly to site1.com/site1, rather than to site1. At present, there is no defined $base_url.
More posts by @Merenda212
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.