0

I have an addon domain (addon.com) on my main account (main.com). Most files work fine, like html files will go to the addon domain (addon.com/test.html). However, PHP files redirect to a subfolder of the main domain. For example, I put test.php in the folder for addon.com, and when I access it in the browser it redirects to

main.com/addon.com/test.php 

instead of

addon.com/test.php

Is this something that I need to set in my .htaccess? Below is the .htaccess file in the main public_html directory. BTW I am using hostgator as a host.

.htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Unless directory, remove trailing slash
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^([^/]+)/$ http://dailydoge.com/$1 [R=301,L]

  # Redirect external .php requests to extensionless url
  RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
  RewriteRule ^(.+)\.php$ http://dailydoge.com/$1 [R=301,L]

  # Resolve .php file for extensionless php urls
  RewriteRule ^([^/.]+)$ $1.php [L]

</IfModule>
Steven Yuan
  • 369
  • 2
  • 3
  • 13

2 Answers2

0

.htaccess won't set php server variables in this way, so $_SERVER['DOCUMENT_ROOT'] and other PHP vars are configured for the main domain ...

To have multiple domains on a server properly you should use a server config tool to set an 'addon-domain'.

If you are on a linux server cPanel is the tool for the job - (usually accessible after logging into your hosting provider)

Philippe
  • 539
  • 1
  • 5
  • 21
0

If you don't need to rewrite anything in your addon_domain, simply create a blank .htaccess file in the subdomain/addon_domain and put this line;

RewriteEngine Off 

then save it and test.

DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127