简体   繁体   中英

Joomla htaccess rewrite exception for custom index.php issue

I am trying to make an exception to the default htaccess from Joomla 1.6.3 for having a friendly url for my own php scripts.

The idea is that the following already working url: www.mysite.com/wrx/system/index.html?parameter1=AE23HtySght34P can externally be called like this, but also shows as: www.mysite.com/wrx/system/AE23HtySght34P/

The rule i placed in the htaccess is working, but reverts it to showing the php with the parameter...

Any help would be appreciated.

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]

Put this one just after RewriteEngine on , so it's the first being evaluated.

RewriteRule /wrx/system/([a-zA-Z0-9]+)$ /wrx/system/index.php?id_parameter1=$1 [L]
  • ([a-zA-Z0-9]+)$ catches all (1+) chars (not only digits) till end of url
  • [L] = last rule (for this evaluation, the rewritten url will be evaluated against the rules again)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM