php - mod_rewrite redirects to the CSS file -
i have mod_rewrite rule cleaning url:
rewriterule ^tshirts*$ /thsirt.php the thought visiting myurl.com/tshirt or myurl.com/tshirts should redirect myurl.com/tshirt.php.
visiting myurl.com/tshirt displayed tshirt.php until added external stylesheet link tshirt.php - redirects css file, i'm left raw source of css file (tshirt.css).
and create more confounding, if navigate myurl.com/tshirts, throws 404.
source of tshirt.php:
<html> <head> <title>page title</title> <link rel="stylesheet" type="text/css" href="/tshirt.css" /> </head> <body> <h1>hello, world.</h1> </body> </html> source of tshirt.css:
body{ background-color: #4f5557; } any thought might causing or how prepare it?
the best solution cover bases, ensure going rewrite need to, , nil shouldn't be.
first, default, should not rewrite refers either specific file, or directory, using:
# not apply if specific file or folder exists rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d adding next next allows specify directories ignore rules for, may there other purposes such called scripts or resources linked externally.
# not apply if refering resource in 1 of these folders rewritecond %{request_uri} "/admin/" [or] rewritecond %{request_uri} "/scripts/" [or] rewritecond %{request_uri} "/external/" rewriterule (.*) $1 [l] then finally, can have rule/s
rewriterule ^tshirts*$ /tshirt.php php .htaccess mod-rewrite
No comments:
Post a Comment