Reputation: 358
I would like to do a rewrite rule to replace this url https://example.com/user.php?user=1000 to https://example.com/1000
If I wanted to rewrite the url to https://example.com/user/1000 I would have done that:
RewriteRule ^(user)/([^/]+)/?$ $1.php?u=$2 [NC,L,QSA]
but how to do it without the user?
Here is my htaccess which is already managing the https redirection:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "https\:\/\/example\.com\/" [R=301,L]
Upvotes: 0
Views: 29
Reputation: 7476
try this but in this case user.php and user parameter will be static.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)$ user.php?user=$1 [L]
Upvotes: 1