Hi all
Appreciate this has been covered a few times here and there, but I've tried several solutions and nothing seems to be working for me - so any guidance would be really appreciated!
I'm trying to keep things somewhat easy to maintain for myself with shared config and models etc. I have several parts to my CodeIgniter setup which would be accessed through a subdomain, but internally would just be a controller folder. For example:
I've tried a few solutions from Stackoverflow. One in particular seemed to fit my use case better than the others, but I tried this one but this just gives me object not found errors.
This is my htaccess based on this:
I'm aware this is for wildcard domains, but even if that works, it would be a step forward for me.
I have run this through a tester (here), and it's returned fine, so I'm a bit lost as to why it's returning "Object not found".
I'm not an expert with htaccess so I've been going around in circles, so any pointers would be great!
Appreciate this has been covered a few times here and there, but I've tried several solutions and nothing seems to be working for me - so any guidance would be really appreciated!
I'm trying to keep things somewhat easy to maintain for myself with shared config and models etc. I have several parts to my CodeIgniter setup which would be accessed through a subdomain, but internally would just be a controller folder. For example:
- admin.domain.com --> domain.com/admin
- users.domain.com --> domain.com/users
- users.domain.com/my-account --> domain.com/users/my-account
- accounts.domain.com --> domain.com/accounts
I've tried a few solutions from Stackoverflow. One in particular seemed to fit my use case better than the others, but I tried this one but this just gives me object not found errors.
This is my htaccess based on this:
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# If it's not a file being accessed
RewriteCond %{REQUEST_FILENAME} !-f
# If it's not a directory being accessed
RewriteCond %{REQUEST_FILENAME} !-d
# And if it's domain.com, with or without www (no subdomain)
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
# Rewrite all requests to index.php adding the query
# string (QSA) and terminating all subsequent rewrite
# processings.
# See: https://httpd.apache.org/docs/current/rewrite/flags.html#flag_end
RewriteRule ^(.*)$ /index.php/$1 [END,QSA]
# If it's not starting with www
RewriteCond %{HTTP_HOST} !^www
# And is a subdomain
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+)\.domain\.com$ [NC]
# Rewrite the request to index.php/test/SUBDOMAIN/whatever...
RewriteRule ^(.*)$ /index.php/%1/$1 [END,QSA]
</IfModule>I'm aware this is for wildcard domains, but even if that works, it would be a step forward for me.
I have run this through a tester (here), and it's returned fine, so I'm a bit lost as to why it's returning "Object not found".
I'm not an expert with htaccess so I've been going around in circles, so any pointers would be great!