url重写不能在php中工作

时间:2016-04-15 07:29:40

标签: url-rewriting

我创建了一个.htaccess文件,并为其添加了一些重写规则,但它没有按预期工作

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^home?$ index.php
RewriteRule ^live/(.+)$  user_stream_view.php?id=$1

第一条规则正常。第二个也是渲染它没有给出任何404错误,而是所有的css和内容搞砸了

Screenshot of webpage with dead images

1 个答案:

答案 0 :(得分:0)

Your problem with stylesheets has no matter with url-rewriting. You should write urls to stylesheets in your template from slash like that:

/styles/main.css

Now I think, you use styles/main.css, and browser tries to load it from /freefootball(sohail)/live/.

Try this rewrite to check:

RewriteRule ^/freefootball(sohail)/live/(.+)$  user_stream_view.php?id=$1