I'm being stuck setting up my htaccess properly. Currently I have the following situation and file structure in my htdocs folder:
As you might guess, the folder "website" contains all the files that should be accessible upon navigation to http://mydomain.com - this works fine with the current htaccess:
RewriteEngine on
# remove www
RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]
# subfolder
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteCond %{REQUEST_URI} !^/website/
RewriteRule (.*) /website/$1
# clean urls
RewriteRule ^website/([a-z0-9\-]+)$ website/$1.php
My problem: While I want my website to be accessible the way it is now I also want to be able to access http://mydomain.com/clients/blala and http://mydomain.com/somefolder etc... With my current htaccess this results in a 404 Error saying "The requested URL /website/clients/blabla was not found on this server."
What do I need to add / change to my htaccess to make this work?
Thanks in advance
This shoud work.
RewriteEngine on
# remove www
RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC]
RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]
# subfolder
RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteCond %{REQUEST_URI} !^/website/
RewriteCond %{REQUEST_URI} !^/somefolder/
RewriteCond %{REQUEST_URI} !^/client/blabla/
RewriteRule (.*) /website/$1
# clean urls
RewriteRule ^website/([a-z0-9\-]+)$ website/$1.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With