我已将此用于网址重写
旧网址
http://localhost/project/productSearch?id_category=7&id_size=23&id_colour=89
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule productSearch/(\d+)/(\d+)/(\d+)$ productSearch.php?id_category=$1&id_size=$2&id_colour=$3 [L]
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} \s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
现在是新网址
http://localhost/project/productSearch/7/23/89
但图片,css.jqyery未在此页面上加载
任何想法?
答案 0 :(得分:2)
您的网页
http://localhost/project/productSearch/7/23/89
重写为
http://localhost/project/productSearch?id_category=7&id_size=23&id_colour=89
因为现在所有资源引用URL都指向错误的位置。您必须更改资源引用URL以匹配新的页面URL(重写后URL)。
例如 - 如果您在早期的情况下使用URL
引用了图像<img src="../../../../images/image.png">
现在它将是
<img src="../images/image.png">