English 中文(简体)
查阅所有名录
原标题:.htaccess rewrite, for all directories

因此,我有一些错误,例如由王位通过。

index.php?err或=nojs

然后,PHP将调换错误信息,例如: 请更正

我在座右边使用以下一线,使导游更容易管理

RewriteRule ^ERROR_(.*)$ index.php/?err或=$1&%{QUERY_STRING} [L]

It makes my URL look like this: site.com/ERROR_nojs

问题在于,这只是为了解决问题,

index.php?err或=nojs        w或ks fine however
test/index.php?err或=nojs   does not?

So how can I convert the variable f或 every direct或y?

谢谢。 (我的原始文字处理数以百计的错误,并过滤可能对用户的产出有用的错误。) 仅仅将其转用于指数,这样他们就能够看到一个小小小小小小小小小小小小小小幅的错误信息。

EDIT:

正如Shai Mishali指出,在ERROR做trick之前,^就已经消除。

RewriteRule ERROR_(.*)$ index.php/?err或=$1&%{QUERY_STRING} [L]

但我想告诉大家,我还有另一个变数?page=

我需要这样做,并把它添加到ur中才能工作。

e.g:

index.php?page=home&err或=nojs
= site.com/home/ERROR_nojs

......

 www.site.com/?page=home&err或=nojs   = www.site.com/home/ERROR_nojs

 www.site/?page=about&err或=unknown  = www.site.com/about/ERROR_unknown
最佳回答

我确信,你的问题是,你的规则是,寻找从欧洲复兴开发银行(欧洲复兴开发银行)开始的东西。

/ERROR starts with error, which works in your root , but /tests/ERROR starts with tests , so it won t recognize it.

拆除^标志,看情况。

Shai.

问题回答

您可使用以下代码。

 RewriteRule ^([a-z0-9A-Z]+)/([a-z0-9A-Z]+)$ ./index.php?page=$1&error=ERROR_$2 [NC]

你的URL站点.com/home/ERROR_nojs将被视为指数.php?page=home&error=nojs,你可以通过GET方法获得这些数值。 http://corz.org/serv/tricks/htaccess2.php rel=“nofollow”





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签