What I am trying to do:
- Making my shop script SEO friendly
- Using htaccess to turn something like
/product.php?id=12345
into/product/awesome-product-name
What I already achieved:
- Link redirection
/product/awesome-product-name
is now a working link
My problem is that I cant load any resources because of the subdir products
. What I need is an easy way to change the paths to images, css and javascript files.
Current .htaccess:
RewriteEngine on
RewriteRule ^produkt/(.*)$ ./product.php?url=$1
RewriteRule 404 404.html
I dont think my question is a duplicate cause my shop files are in a sub-directory of the main webserver. So I cant access my css and js files just by putting a /
in the href, like it was the answer in one of the given duplicates
.
FIXED
My solution is adding the RewriteRule RewriteRule ^produkte/(css|js|img)/(.*)?$ /shop/$1/$2 [L,QSA,R=301]
to my .htaccess
file.