$_GET doesn't work with .htaccess rewrite remove php extension


profit

The following URLs:

https://example.com/rewards.php&id=307658063902 (can't get ID via GET)

or

https://example.com/rewards&id=307658063902 (not found returns error)

Doesn't work for retrieving GET variable IDs via php:

$id = $_GET["id"];

I think there might be a bug in the .htaccess file, this is:

Options -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [NC,L]
Prabaharan Rajendran

Did you miss it? In your url, try the following example and check:

https://example.com/rewards.php?id=307658063902
$id = $_GET["id"];
echo $id;

Sample output:

307658063902

Related


$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

Rewrite 301 index.php to / doesn't work on htaccess

scooter I'm trying to redirect to / using index.php/index.html, but when I add the following code at the top: RewriteRule ^index.(php|html|htm)$ / [R=301,L] RewriteRule ^([a-z0-9-_]+)/index.(php|html|htm)$ /$1/ [R=301,L] My current code doesn't work: Options

.htaccess get variable via URL rewrite doesn't work

GROVER。 I have a script in my .htaccessfile that tries to change the URL localhost/testing/user/index?username=examplefrom localhost/testing/user/example. I do this just to make my site look "cleaner" and to make it easier for users to navigate. Here is my cur

.htaccess rewrite doesn't work?

username Instead of using a URL like this: www.website.com/developer.php?u=username I tried to create the URL: www.website.com/developer/username with the following code in .htaccess : RewriteEngine On RewriteBase / # Change developer URL RewriteRule ^([a-zA-

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

htaccess rewrite rules and remove php file extension

belief E. I have the following code in my htaccess file to remove the PHP extension: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] However, now that I've added a file in /directory/index.php, I can only access it us

htaccess rewrite and remove .php extension

Folkman So I've been reading mod_rewrite because I want to remove the .php extension and make the URL look different so that the end user doesn't see all the parameters in the URL. My goal: /foo.php?p=barto look like:/foo/bar foo and bar can be numbers and cha

htaccess doesn't remove php extension

Vishvendra Singh I have a PHP project running. I am running my project on localhost. I want to remove the php extension from the url in the address bar. I tried several htaccess scripts and none of them worked, some showed 404 not found errors or didn't work a

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

$_GET doesn't work with .htaccess rewrite remove php extension

profit The following URLs: https://example.com/rewards.php&id=307658063902 (can't get ID via GET) or https://example.com/rewards&id=307658063902 (not found returns error) Doesn't work for retrieving GET variable IDs via php: $id = $_GET["id"]; I think there m

htaccess doesn't remove php extension

Vishvendra Singh I have a PHP project running. I am running my project on localhost. I want to remove the php extension from the url in the address bar. I tried several htaccess scripts and none of them worked, some showed 404 not found errors or didn't work a