My website runs in the following url www.mywebsite.com without any problem. So, when creating the project I applied some .htaccess
rules in my root folder, as follow:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Remove www
RewriteCond %{HTTP_HOST} ^www.mywebsite.com$ [NC]
RewriteRule ^(.*)$ https://mywebsite.com$1 [R=301,L]
# Remove http and force https
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [QSA,R,L]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>
The issue is that if I access www.mywebsite.com/public
I still view the website but without the CSS applied (because the URL is wrong).
How can I redirect the URL www.mywebsite.com/public
to www.mywebsite.com
, without set on fire my urls www.mywebsite.com/public/img/someimage.png
?
Edit: To make myself clear:
www.mywebsite.com -> it's working -> I don't want to change that
www.mywebsite.com/public/img/someimage.png -> it's working -> I don't want to change that
www.mywebsite.com/public -> It's working -> I see my website without the CSS applied -> I WANT to change this by redirecting users to www.mywebsite.com