In a folder named rewrite I have two files, .htaccess and index.php
<rewrite>
- .htaccess
- index.php
In .htaccess I have this content
RewriteEngine On
RewriteRule ^([a-z0-9]+)?$ index.php?id=$1 [NC,L]
and in index.php
<?php
echo $_GET['id'];
?>
Isn’t supposed when I visit http://www.domain.com/rewrite/1234 I would get an output of 1234 ?
Instead of this there is created a file application/x-httpd-php for downloading that contains the code of index.php
I am trying to figure out why I can not make this happen. What am I missing here?
UPDATE
I have tested two web servers and local server. Finally it worked on one of the web servers, meaning that it has something to do with the configurations.
What should I do about it ?
Is possible that one of your servers hasn’t got the mod_rewrite activated.
To ensure make a test:
In a folder make two files:
– .htaccess
– rewrite.php
In
.htaccesput:and in
rewrite.phpput: