Jump to content

Mod rewrite works, but wrong get string?


idkwhy

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.