Joomla-htaccess为自定义index.php问题重写异常


Joomla htaccess rewrite exception for custom index.php issue

我试图对Joomla 1.6.3中的默认htaccess进行例外处理,因为我自己的php脚本有一个友好的url。

这个想法是以下已经工作的url:www.mysite.com/wrx/system/index.html?参数1=AE23HtyLight34P可以这样对外调用,但也显示为:www.mysite.com/wrx/system/AE23HtyLight34P/

我在htaccess中放置的规则正在工作,但将其恢复为显示带有参数的php。。。

如有任何帮助,我们将不胜感激。

Simon

.htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*'([^)]*') [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|'[|'%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|'[|'%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule ^wrx/system/([A-Za-z0-9-]+)$ /wrx/system/index.php?id_parameter1=$1 [R=301,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index'.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|'.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

把这个放在RewriteEngine on之后,所以它是第一个被评估的。

RewriteRule /wrx/system/([a-zA-Z0-9]+)$ /wrx/system/index.php?id_parameter1=$1 [L]
  • ([a-zA-Z0-9]+)$捕获所有(1+)个字符(不仅仅是数字),直到url结束
  • [L] =最后一条规则(对于此评估,将再次根据规则评估重写的url)