htAccess所需的帮助和帮助 [英] Help and assistance required with htAccess
问题描述
我正在尝试为我的个人网站创建一个小的htaccess( http://lavanyadeepak.net23.net/ [ ^ ])。目前我在PHP(index.php)中有类似于masterpage的东西,顶部工具栏链接使用查询字符串重定向。
根据查询字符串,在进行一些完整性检查和业务规则验证后,我正在显示链接的相应信息。但是因为每个URL显示为index.php(index.php?pg和index.php?pg = 2),统计数据非常混乱,因此我试图看看我是否可以在htAccess中获取URLRewriter,这将执行以下操作
index.php后的任何内容都会被重写为index.php?pg =< anything>
虽然我能够得到这个,但是会发生什么是index.php / something / something渲染默认内容但图像被破坏,因为Web服务器认为图像应该来自/ something / something /
我们有没有办法让htAccess将index.php之后的任何东西翻译成index.php?pg =< anything>但是在遇到第一个/?
I am trying to create a small htaccess for my personal website (http://lavanyadeepak.net23.net/[^]). Currently I have something similar to masterpage in PHP (index.php) and the top toolbar links redirect with a querystring.
Depending upon the querystring and after doing a bit of sanity checks and business rules validation, I am displaying an appropriate information for the link. But since every URL shows as index.php (index.php?pg and index.php?pg=2), the statistics is quite confusing and hence I am trying to see if I can get a URLRewriter in htAccess which would do the following
Anything after index.php would get rewritten as index.php?pg=<anything>
While I was able to get this, what happens is index.php/something/something renders the default content but the images are broken because the web server thinks the images should be served from /something/something/
Is there a way we can have a htAccess which would translate anything after index.php to index.php?pg=<anything> but stop this anything translation on encountering the first /?
推荐答案
时停止这个翻译请看:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html [ ^ ],
参见: http://www.iwebtool.com/htaccess_url_rewrite [ ^ ]。
-SA
Please see:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html[^],
see also: http://www.iwebtool.com/htaccess_url_rewrite[^].
—SA
这篇关于htAccess所需的帮助和帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!