Reputation: 11
I want to create a .htaccess file which redirects me from
https://example.net/@UserName
to https://example.net/user/index.php?user=UserName
, but only when there is the @
.
Can someone please help me?
Upvotes: 1
Views: 81
Reputation: 41219
You can use this in your htaccess
file:
RewriteEngine On
RewriteRule ^@([^/]+)/?$ https://example.net/user/index.php?user=$1 [L,R]
This will redirect a URL of the form example.com/@foobar
to https://example.net/user/index.php?user=foobar
changing the URL in browser address bar. However, if you do not want the URL to change, use the following instead
RewriteEngine On
RewriteRule ^@([^/]+)/?$ /user/index.php?user=$1 [L]
Upvotes: 1