idkwhy Posted September 17, 2014 Share Posted September 17, 2014 Seems to be a popular topic here - rewriting urls to have slashes instead of ?'s and ='s... Fortunately, my rewrite is working, but php is displaying the wrong string, and I can't figure out why. My .htaccess is: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^file/(.*)$ ./file.php?str=$1 [L] Going to something like example.com/file/anythinghere/ works but php says the $_GET['str'] is anythinghere.php/anythinghere and that's not right. In a case like that, I just need "anythinghere" Is my htaccess wrong? There is nothing in my php code that is manipulating the string to do this. If I go to example.com/file.php?str=anythinghere "anythinghere" is displayed solo Link to comment https://forums.phpfreaks.com/topic/291115-mod-rewrite-works-but-wrong-get-string/ Share on other sites More sharing options...
idkwhy Posted September 17, 2014 Author Share Posted September 17, 2014 Figured it out. It was this line: RewriteRule ^(.*)$ $1.php Now.. if any patient person could explain why, that'd be awesome! And much appreciated. Link to comment https://forums.phpfreaks.com/topic/291115-mod-rewrite-works-but-wrong-get-string/#findComment-1491360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.