I'm currently having a hard time rewriting a URL. The .htaccess file already contains some rules so I need to add a new rule to the existing ones. The current rule includes redirecting to https:// if http:// was used (except if the URL contains 'php05142013'). Here's the current content of the .htaccess file:
ErrorDocument 404 https://mycreditstatus.co.za/404.php
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^mysite\.co\.za$ [NC]
RewriteCond %{REQUEST_URI} !^/(php01202015) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.mysite\.co\.za$ [NC]
RewriteCond %{REQUEST_URI} !^/(php01202015) [NC]
RewriteRule (.*) https://mycreditstatus.co.za [L,R=301]
What I want to achieve now in addition to the current rules, is to rewrite the URL like https://mysite.co.za/3pv/XnAnr3ABtgo%3D/3irqrHe%2FQJE%3D
into https://mysite.co.za/index.php?action=register&auth=1&p=3pv&eid=XnAnr3ABtgo%3D&us=3irqrHe%2FQJE%3D
I've been trying something like ^/([^A-Za-z0-9.)(/\\\\%-])/([^A-Za-z0-9.)(/\\\\%-])/([^A-Za-z0-9.)(/\\\\%-])/([^A-Za-z0-9.)(/\\\\%-])/?$ index.php?action=register&auth=1&p=$1&eid=$2&us=$3&%{QUERY_STRING} [NC,L] # Process product requests
and I'm sure it's wrong. I'm new to mod rewrite and I find it very confusing. Any help would be appreciated. Thanks.
您可以使用以下新规则:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?action=register&auth=1&p=$1&eid=$2&us=$3 [QSA,L]
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.