Welcome! Log In Create A New Profile

Advanced

Rewrite Rules nginx/1.2.1 index.php?go=XXX to XXX.php

Posted by DennisSG 
Rewrite Rules nginx/1.2.1 index.php?go=XXX to XXX.php
June 03, 2014 10:13PM
Hello,


I want to rewrite http://www.forExample.org/index.php?go=download to http://www.forExample.org/download.php
Execpt the index.php all file-extentions are .inc like download.inc.

"
index.php contains

<?
while (list ($var, $value) = each ($_REQUEST))
$$var = $value;


if(!isset($go))
$go = "index";
if(file_exists("$go.inc"))
include("$go.inc");
else
include("index.inc");
"

So I tried the the following line without success (vhost.conf):

rewrite ^/.php/([^/\.]+)/?$ /index.php?page=$1 break;
rewrite ^/(.*)\.php$ /?go=$1 redirect;
rewrite ^/(.*).php$ /?go=$1;
rewrite ([^index]+)\.php /index.php?go=$1 break;
rewrite ('/^([^index]+)\.php$ /?go=$1 break;
rewrite ([^index]+)\.php /index.php?go=$1 break;

then I tried a new location-Block

location ~ \index.php?go=$ {
if (!-f $request_filename) {
rewrite ^(.*)\?go=$ $1.php permanent; }
}

Also with no success.


Maybe someone can help me ;)

I want to do enter .php to get my content ;)
Re: Rewrite Rules nginx/1.2.1 index.php?go=XXX to XXX.php
June 05, 2014 06:03AM
This is the rest of my vhost.conf for this site


"
server {
listen 85.xx.243.xx:80;
server_name censored.de *.censored.de;
access_log /var/customers/logs/censored-access.log combined;
error_log /var/customers/logs/censored-error.log error;
root /var/customers/webs/censored/;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^ /index.php last;
}
location /webalizer {
alias /var/customers/webs/censored/webalizer/censored.de/;
auth_basic "Restricted Area";
auth_basic_user_file /etc/nginx/froxlor-htpasswd/8-75284aa9bcc4cec762fa3e432cc.htpasswd;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/nginx/censored.de-php-fpm.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
"
Re: Rewrite Rules nginx/1.2.1 index.php?go=XXX to XXX.php
June 05, 2014 11:24PM
stillborn forum.
SOLVED. U can delete this post....
Here are no aktiv helping people ;)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 287
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready