2

How to redirect a url of the form

localhost/website/xxxx.xxxx

to

localhost/website/index.php?i=xxxx.xxxx

,where x is a number, for example xxxx.xxxx can be 7234.5432. The htaccess file is located in the website folder.

gbd
  • 213
  • 1
  • 11

1 Answers1

1

First of all, you need to activate mod_rewrite

then add this to your .htaccess:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^([0-9]{4}\.[0-9]{4})$ index.php?i=$1
Supamiu
  • 8,501
  • 7
  • 42
  • 76
  • I made a mistake by placing the "+" inside the [0-9], try it now and it should work ^^ – Supamiu Aug 12 '15 at 07:39
  • Sorry to bother you again. I may be asking to much but this seems to work for [any number of x's].[any number of x's] is it possible to make it only work for [four x's].[four x's], Thanks – gbd Aug 12 '15 at 07:47