Jump to content

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

Edited by idkwhy
Link to comment
https://forums.phpfreaks.com/topic/291115-mod-rewrite-works-but-wrong-get-string/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.