Reputation: 1621
I am trying to rewrite a condition that can take any page that has numbers.html, lets say the like the following:
12345.html
33443.html
234545656.html
9797423.html
and just redirect it to index.php
RewriteRule ^([0-9]+)$ index.php [L]
I tried the following but it doesn't work, any help is very much appreciated.
Upvotes: 0
Views: 18
Reputation: 42885
Two immediate issues with your code:
.html
, then you have to code that. Have a try with this:
RewriteEngine on
RewriteRule ^([0-9]+)\.html$ index.php [L]
Then a few more hints:
.htaccess
style files. But the usage of such files has to be enabled first in your http server configuration. .htaccess
style file has to be placed at the correct location, in this example within the folder actually holding the index.php
file. And a general remark:
Those .htaccess
style files are notoriously error prone, hard to debug and they really slow down the http server, often for nothing. You should always prefer to place such commands inside the real host configuration of your http server. .htaccess
style files are only offered as a last option for situations where you have no access to that configuration, for example when using a really cheap shared hosting provider.
Upvotes: 2