开发者

htaccess problem cleaun up request uri

开发者 https://www.devze.com 2023-03-06 17:46 出处:网络
I am using following htaccess code Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} !^www\\.digilink\\.co$ [NC]

I am using following htaccess code

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.digilink\.co$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{REQUEST_URI} ^($|/.*$)


RewriteRule开发者_如何学JAVA ^category/([a-z]+)-([a-z]+) /search.php?cat=$1-$2 [NC]
RewriteRule ^category/([a-z]+) /search.php?cat=$1 [NC]

#non www to www

RewriteCond %{HTTP_HOST} !^www\.digilink\.co$
RewriteRule (.*) http://www.digilink.co/$1 [R=301,L]


# custom error documents
ErrorDocument 404 http://www.digilink.co/404.php

As the URI is converted as www.digilink.co/category/automotive no CSS and images are loaded. As the directory is added. Please help me with the query.


what are your css and image sources?

<img src="images/image.jpg"> 

or

<img src="/images/image.jpg"> 

In this case, you probably want the second style so that it always resolves to http://www.digilink.co/images/image.jpg


I can suggest you to add who more conditions to check if the requested link is not directory or file and then rewrite it

RequestCond %{REQUEST_FILENAME} !-f
RequestCond %{REQUEST_FILENAME} !-d
0

精彩评论

暂无评论...
验证码 换一张
取 消