开发者

Friendly url rewriting with php & .htaccess. Difficulties with relative links to css images & js

开发者 https://www.devze.com 2023-01-09 11:07 出处:网络
I\'ve currently an url like that : play.php?place=idplace&event=idevent I\'ve enabled friendly url this way :

I've currently an url like that : play.php?place=idplace&event=idevent

I've enabled friendly url this way :

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ play.php?place=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ /play.php?place=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ /play.php?place=$1&event=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ /play.php?place=$1&event=$2

For just one parameter (the place id there), all is ok. But when it comes two params (place and event) like that mysite/theplace/theevent all my relatives links (css, js and imgs) are not working, my page seems to think it is actually in the the开发者_Go百科place/ folder, and non in the root/ one.

Ideas for this issue?

Thanx a lot

Guillaume


You must use paths that are absolute from at least the domain, i.e.

/images/myimage.png

You may be able to fix this one problem in another way, but it will only become more annoying as your URL rewriting becomes more advanced.

0

精彩评论

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