on ubuntu 13.04 and apache2 and php 5.4 i got the 404 error. mod rewrite is enabled on my machine
my .htaccess code is like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/dl/([0-9]+)/$ dl.php?id=$1
</IfModule>
and the dl.php is set up for just echo the variables:
<?php
print_r($_GET);
?>
on output when i will go to this address http://localhost/digidoc/dl/5
it shows the 404 error
ps:the .htaccess file included in digidoc folder and digidoc folder is in web server root
Change
RewriteRule ^/dl/([0-9]+)/$ dl.php?id=$1
Into
RewriteRule ^/digidoc/dl/([0-9]+)/?$ dl.php?id=$1
Notice the ?, so the last slash is optional. Also add digidoc/
as the rule is applied to the whole url.
You need to get rid of the leading slash:
Options -Multiviews
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /digidoc/
RewriteRule ^dl/([0-9]+)$ dl.php?id=$1 [L,QSA]
</IfModule>
You should also include a rewrite base as well as making sure that you have multiviews turned off.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.