php - Mod_Rewrite - CSS and Images not found -
i know easy questions confused now. tried several options result same: css file not found if use mod_rewrite
what solution should contain:
- domain.tld -> www.domain.tld
- www.domain.tld/category/page-title -> index.php?a=category&b=page-title
- www.domain.tld/category/page-title/ -> index.php?a=category&b=page-title
- www.domain.tld/category -> index.php?a=category
- www.domain.tld/category/ -> index.php?a=category
.htaccess:
options +followsymlinks rewriteengine on rewritecond %{http_host} ^domain.tld rewriterule (.*) http://www.domain.tld/$1 [r=301,l] rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^(.*)/(.*)/?$ index.php?a=$1&b=$2 rewriterule ^(.*)/?$ index.php?a=$1 [l]
index.php:
<link href="/css/bootstrap.min.css" rel="stylesheet"> <link href="/css/internal.css" rel="stylesheet">
problem last rewrite rule running without rewritecond
skip real files/directories , routing js/css/image files index.php
.
have this:
options +followsymlinks rewriteengine on rewritecond %{http_host} ^domain.tld rewriterule (.*) http://www.domain.tld/$1 [r=301,l] # skip files , directories rules below rewritecond %{request_filename} -d [or] rewritecond %{request_filename} -f rewriterule ^ - [l] rewriterule ^(.*)/(.*)/?$ index.php?a=$1&b=$2 [l,qsa] rewriterule ^(.*)/?$ index.php?a=$1 [l,qsa]
Comments
Post a Comment