Welcome Guest, Not a member yet? Register   Sign In
Multiple domains with one codebase - how to set htaccess file?
#1

Hi,

I have multiple domains (two at the moment, but might be more later on), and I want them all to use the same CodeIgniter codebase, but each domain will use its own database.

I have the basic concept figured out (I hope), but the only thing I'm struggling with is the htaccess file. I want it to handle the removal of index.php from the url, as well as redirect to https and www.

Below is my .htaccess file.
On localhost it works well, but on the remote servers it creates an seemingly endless chain of index.php/index.php/index.php etc.

What am I missing here?

If it matters, I'm using CI 3.1.9



Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#localhost
RewriteCond %{HTTP_HOST} localhost
RewriteRule ^(.*)$ http://localhost/pi/index.php/$1 [NC,R,L]

#firstdomain
RewriteCond %{HTTP_HOST} firstdomain.com
RewriteRule ^(.*)$ https://www.firstdomain.com/index.php/$1 [NC,R,L]

#seconddomain
RewriteCond %{HTTP_HOST} seconddomain.com
RewriteRule ^(.*)$ https://www.seconddomain.com/index.php/$1 [NC,R,L]
Reply


Messages In This Thread
Multiple domains with one codebase - how to set htaccess file? - by einav - 03-06-2019, 04:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB