I have searched for this but nobody have the same issue..
Now I need an code to transform the ugly url (thats what i have) to the nice url:
- Ugly url: domain.com/aanmelden?referral=admin
- Nice url: domain.com/aanmelden/admin
Ik have tried soo many codes, but no one did work for me. ):
suggestions?
Thnx!
(My current htaccess: )
ErrorDocument 401 /errordocs/401.php
ErrorDocument 403 /errordocs/403.php
ErrorDocument 404 /errordocs/404.php
ErrorDocument 500 /errordocs/500.php
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.nl$ [NC]
RewriteRule ^(.*)$ http://domain.nl/$1 [L,R=301]
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{THE_REQUEST} ^[A-Z]+\s.+\.php\sHTTP/.+
RewriteRule ^(.+)\.php $1 [R=301,L]
Where and what i need to place?
EDIT:
To be clear:
- If the user goes to the Nice Url, they wil stay on the nice one.
- If the user goes to the Ugly Url, they wil redirect to the Nice url.
This is a trivial rewrite:
If
admincan be any lowercase string, use the pattern([a-z]+)$to capture one or more lowercase letters after the/and before the end of the request URI.If
adminis really onlyadmin, you can hard-code it asUpdate
In context of your existing rewrites just posted, you’ll need to add this rule before the rule that adds .php since that would also match this pattern.
Update 2
If you want the end user to get the ugly URL and rewrite it to the nice one, use: