I have the urls
https://example.net/app/ref/user/u123456
https://example.net/app/ref/user/u123456/
Need redirect both url to https://example.net/app/ref/user/index.php?referral=u123456
How to do it with a file .htaccess? Unfortunately, I couldn't do it, so I'm asking for your help.
UPD: Now me .htaccess is in the same directory as index.php:
<IfModule mod_rewrite.c>
RewriteEngine on
</IfModule>
AddType application/x-httpd-php .html
<Files 403.shtml>
order allow,deny
allow from all
</Files>
CodePudding user response:
With your shown samples please try following htaccess rules file. Please make sure you keep your .htaccess rules file in your root folder; alongside with your app folder.
Make sure to clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*/[^/]*/[^/]*)/([^/]*)/?$ $1/index.php?referral=$2 [QSA,L]