需要mod_rewrite的URL信息(mod_rewrite URL info required)

   IT问题网   2018-07-23 00:00:00

问 题

我是新来这个mod_rewrite的。 我已经能够成功改写网址是这样的: http://mydomain.com/products/12 这样: http://mydomain.com/products.phpprodid=12

但是,当我给 http://mydomain.com/products/12 在地址栏,不加载css和js文件。

但是,当我访问 http://mydomain.com/products.phpprodid=12 的js和css得到正确加载。请让我知道如果我失去了一些东西。

我的.htaccess看起来是这样的:

 选项+了followsymlinks
rewriteengine叙述上
重写规则^产品/([0-9] [0-9])/ $ /products.phpprodid=$1 [l]
 

我的css和js文件夹也都是在同一个文件夹中。

解决方案

您需要知道,相对uri(因此绝对和相对的uri路径太)是从基本uri是解决 - 如果没有明确宣布 - 的uri当前文档。

所以,如果你从引用外部资源/产品/ 12 与相对uri 富/条,它解决了以 /产品/富/酒吧。

要解决此问题,使用绝对uri路径或绝对uri(与协议开头)或明确设置比当前基本uri等(见(与 / 开始) basehtml元素)。但是请注意,改变基本uri有一定的副作用,因为它影响的每次的相对uri。

标签:需要信息



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

的.htaccess,迫使斜线和www(.htaccess, forcing a slash and www)

problem can someone please help me to force my website to ...

简单的301重定向在.htaccess与查询字符串不以重定向指令工作(Simple 301 redirect in .htaccess with query string does not work with Redirect directive)

problem i am trying to redirect a single url in a .htacce ...

如何将文本转换使用的.htaccess为小写的网址(How to convert text to lowercase URLs using .htaccess)

problem i want to set up 301 redirects in my .htaccess fi ...

"双向"改写("Two Way" Rewrite)

problem so, i'm trying to accomplish this: we have a url ...

与字preSS除非使用URL重写不工作[R](Url rewriting not working with wordpress unless using [R])

problem i have a wordpress installation on my website on ...

通过htaccess的重定向所有的HTTP和HTTPS非www网址https://www.xyz.com(Redirect all http AND https non-www URLS to https://www.xyz.com via htaccess)

problem for reasons much too long and complex to get into ...

重定向的* .htm为* .PHP(Redirect *.htm to *.php)

problem i am trying find out how to redirect all traffic ...

HTTPS重定向到非www和http到www(Redirect https to non-www and http to www)

problem i searched and found hundreds of related cases, b ...

如何从URL使用htaccess的本地主机和主机服务器删除“/公众”?(how can remove '/public' from url using htaccess for localhost and host server)

problem i'm using zend framework 2 on xampp. i created .h ...

的.htaccess重写规则到路径不改变网址(.htaccess RewriteRule to path without changing URL)

problem so, i've this problem: base website located at ...

我怎样才能mod_rewrite的,并保持查询字符串?(How can I mod_rewrite and keep query strings)

problem i want to mod_rewrite a url to another page, but ...

如何从PHP脚本改变外观的URL(How to change appearance of URL from within a PHP script)

problem i have some php and html in the same file, and i ...

删除尾随的问号htaccess的(Removing trailing question mark with htaccess)

problem can someone help me understand this code # remov ...

URL重写GET参数(URL Rewrite GET parameters)

problem i want my url to look like the following www.web ...

htaccess的从XAMPP转向灯开的Ubuntu 13.10后不工作(启用htaccess的Apache中的Linux服务器)(htaccess is not working after moving from XAMPP to LAMP on ubuntu 13.10 (Enable htaccess in apache linux server))

problem my codeigniter project is running successfullyon ...

查询字符串和放大器;国防部重写(Query Strings & Mod ReWrite)

problem i'm not too inexperienced with rewrite (not a mas ...

在.xml文件PHP的错误?(PHP error in .xml file)

problem ok firstly, i added this line to my .htaccess fil ...

使用Apache的mod_rewrite解析搜索引擎友好的URL(using apache's mod_rewrite to parse SEO friendly URL's)

problem how do i convert something like me.com/profile/2 ...

搜索引擎友好的URL(Search-Engine Friendly URLs)

problem i am working on building my first search-engine f ...

斜杠之后将文字与.htaccess的变量(Turn text after slashes into variables with HTACCESS)

problem i need to pass 3 variables with a url but using s ...