Reputation: 110
I want your help. I have this url: wwww.myurl.com/?verfy=CDPOR888 OR wwww.myurl.com/index.php?verfy=CDPOR888
I would like to be like this: wwww.myurl.com/CDPOR888
Please help, how can i do it with .htaccess?
I tried this code in .htaccess but not working:
RewriteRule ^([^/]*)\.php$ /?perms_verify=$1 [QSA,L,NC]
but the problem is .php, when i remove it i get an error.
NOTE: .htaccess with case insensitive
Upvotes: 3
Views: 64
Reputation: 301
Please replace this rule!
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
# Use this rule
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Upvotes: 1
Reputation: 1
Update your .htaccess file as
DirectoryIndex index.php
# remove the next 3 lines if you see a 500 server error
FileETag none
ServerSignature Off
Options All -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([0-9a-zA-Z_-]{1,16})$ index.php?verify=$1 [L]
</IfModule>
On wwww.myurl.com/index.php page , write the logic to catch verify value using GET method and do your further operations
Upvotes: 0
Reputation: 785128
You may just use this rule:
RewriteEngine On
# request is not for a file
RewriteCond %{REQUEST_FILENAME} !-f
# request is not for a directory
RewriteCond %{REQUEST_FILENAME} !-d
# rewrite to destination path
RewriteRule ^([\w-]+)/?$ ?verfy=$1 [QSA,L]
Upvotes: 2