douye6812 2011-05-17 13:45
浏览 22

htaccess问题清理请求uri

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.

  • 写回答

2条回答 默认 最新

  • douyun1950 2011-05-17 13:50
    关注

    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
    
    评论

报告相同问题?

悬赏问题

  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行