Welcome Guest, Not a member yet? Register   Sign In
Single RewriteRule for root and subdirectory deployments?
#1

[eluser]jabbett[/eluser]
I have a CodeIgniter application which I need to deploy in multiple environments through the software development lifecycle (dev, test, staging, production). In the earlier environments, the software runs off a subdirectory of the web server, e.g. http://localhost/~username/index.php, and in the later environments, it runs on a dedicated web server, e.g. http://www.myapplication.com/index.php.

Ideally, I'd like to include a single htaccess file that will work automatically in both environments. So far, I've been forced to change the RewriteBase value in each setting.

Development
Code:
RewriteEngine On
RewriteBase /~username/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1

Production
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1

Is there any way around this, or will I need to maintain unique htaccess files for each deployment?

Thanks in advance.




Theme © iAndrew 2016 - Forum software by © MyBB