I have a site that uses wordpress for the frontend & a Codeigniter app for a ‘webshop’ backend. The WordPress structure isn’t in the root, rather it is in the /wp
directory.
I require some .htaccess rules that rewrite as follows:
I am trying to do the following –
- if users goes to www.company.com then it does the rewrite rule for the wp (wordpress) folder
- if users goes to admin.company.com then it does the rewrite rule to the index.php (for the Codeigniter app)
- The final bit is required for the mod_rewrite for wordpress URLS.
The problem I have is that I cannot get both rule 1 and rule 2 working because of RewriteBase rule used – can anyone suggest how to get to use RewriteBase per rule (eg more than once) or similar command to do this?
RewriteCond %{HTTP_HOST} ^(www.)?company.com$
RewriteRule ^(/)?$ wp [L]
RewriteCond %{HTTP_HOST} ^admin.company.com$
RewriteRule index.php [L]
RewriteBase /wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
RewriteRule ^(.*)$ /index.php?$1 [L]
If you have the codeigniter index file in your root, then you can probably leave the .htaccess file alone and just use the routes file in your codeigniter app.