. htaccess does not load css or images


My next error is with the htaccess I do not load the css files or anything

RewriteEngine On
RewriteRule ^blog?$ web.php
RewriteRule ^blog/c/([0-9]+) web.php?id=$1'
asked by Josbert Hernandez 11.08.2016 в 04:07

2 answers


To avoid that the rewrite affects the components of the page, it is necessary to put a RewriteCondition before the rewrite, otherwise Apache will send any request to web.php, for example:

## solo cambia la URL si la solicitud no es para algo en la carpeta css
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^blog/c/css.*$
RewriteRule ^blog/c/([0-9]+) web.php?id=$1 [QSA]

This assumes that your .htaccess and web.php are left in / YOLO /, and that YOLO is the virtual folder. [QSA] allows the parameter you extract with ([0-9]+) to be added to the querystring. If YOLO is a normal folder, put RewriteBase /YOLO/

answered by 11.08.2016 в 05:24

One of the problems when using Friendly Urls htaccess is that the links and link remain absolute:

I use this rule htaccess in a project of an online store.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([a-zA-Z0-9-/]+)$ detalle.php?id=$1

If you can see in the following link link is a friendly url and images like styles, jquery bookstores not they are absolute

<script src="js/jquery.min.js" type="text/javascript"></script>

I usually charge them without having to change routes in this way (../js/)

<script src="../js/jquery.min.js" type="text/javascript"></script>

answered by 11.08.2016 в 04:43