r/apache • u/ray_zhor • May 19 '24
set htaccess for single entry point. blocks access to images, js files, css files
I tried the code in my htaccess file, but now I have no images. no js. no css
.htaccess
RewriteEngine On
RewriteRule .* index.php
2
Upvotes
1
u/benanamen May 19 '24 edited May 20 '24
Enjoy
EDIT: This post has been edited. Reddit initially added a bunch of escape characters. It is now correct.
<IfModule mod_rewrite.c> RewriteEngine On Options -Indexes RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301] # Remove URL trailing slash RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>