Reputation: 247
How can I rewrite this kind of url with htaccess .. the example is below with these dummy urls
update the .htaccess so when someone goes to http://cheapbats.mediagroup.com/19 it redirects them to http://cheapbats.cmediagroup.com/index.php?ref=19
The rule is, if not a directory or file,
and it is a number, then redirect it to index.php?
ref=[number]
Upvotes: 1
Views: 56
Reputation: 784918
You can try this rule in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)/?$ /index.php?ref=$1 [L,QSA]
Upvotes: 1