We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36814
    • 1 Posts
    I've created my MODX site within a subfolder called "site" and would now like to redirect to the main domain "eveshamdesigns.com" but i'm having a few issues!

    Here is my .htaccess file:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?eveshamdesigns.com$
    RewriteCond %{REQUEST_URI} !^/site/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /site/$1
    RewriteCond %{HTTP_HOST} ^(www.)?eveshamdesigns.com$
    RewriteRule ^(/)?$ site/index.php [L]
    


    At the site http://eveshamdesigns.com it loads the homepage correctly from the subfolder but EVERY link still goes to the "site" subfolder (even when i try and manually type "eveshamdesigns.com/contact-us" in the address bar, it redirects to the subfolder version. I'm using [[base_url]]page-name.html to call urls for linking.

    Any ideas what i'm missing/doing wrong?
      • 33968
      • 863 Posts
      It looks like you're still rewriting your urls to the /site/ subfolder, even if it no longer exists.

      Try this instead:
      RewriteEngine On
      RewriteBase /
      
      RewriteCond %{HTTP_HOST} .
      RewriteCond %{HTTP_HOST} !^www\.eveshamdesigns\.com [NC]
      RewriteRule (.*) http://www.eveshamdesigns.com/$1 [R=301,L]
      
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]