UnknownPlayer Posted July 10, 2011 Share Posted July 10, 2011 I have this code in .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(usluge|masine|o-nama|kontakt)?$ ./$1.php [L,QSA] RewriteRule ^usluge/(.*)$ usluge.php?q=$1 [L,QSA] It works fine for addresses /usluge, /masine, /o-nama, /kontakt, but now i wonna go to www.example.com i got this error: Not Found The requested URL /des-com/.php was not found on this server. How to fix that? Thanks.. Link to comment https://forums.phpfreaks.com/topic/241613-indexphp-rewrite/ Share on other sites More sharing options...
cags Posted July 11, 2011 Share Posted July 11, 2011 The question mark in your regex pattern makes the capture group optional, which means an empty URI will match. Simply removing the question mark will probably solve it. Link to comment https://forums.phpfreaks.com/topic/241613-indexphp-rewrite/#findComment-1241137 Share on other sites More sharing options...
UnknownPlayer Posted July 11, 2011 Author Share Posted July 11, 2011 It works, thanks.. Link to comment https://forums.phpfreaks.com/topic/241613-indexphp-rewrite/#findComment-1241193 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.