My website is v2.example.com and I am trying to write a .htaccess rule but unable.
I want this : v2.example.com/ABCDEFGH
And I want to get the value ABCDEFGH as a parameter like it is v2.example.com/index.php?id=ABCDEFGH
can anyone please help me sorting out this problem.
I tried this :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*) index.php?id=$1 [L]
</IfModule>
Please help me.
Have your rule like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+index\.php\?id=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,L]
# internal forward from pretty URL to actual one
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?id=$1 [L,QSA]
</IfModule>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With