htaccess问题清理请求uri
我正在使用以下 htaccess 代码
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.digilink\.co$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{REQUEST_URI} ^($|/.*$)
RewriteRule ^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
,因为 URI 被转换为 www.digilink.co/category/automotive,所以不会加载 CSS 和图像。添加目录后。请帮我查询一下。
I am using following htaccess code
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.digilink\.co$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{REQUEST_URI} ^($|/.*$)
RewriteRule ^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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的CSS和图片来源是什么?
或者
在这种情况下,您可能需要第二种样式,以便它始终解析为 http://www. digilink.co/images/image.jpg
what are your css and image sources?
or
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