April 21, 2015 09:26AM
Hello Francis,

server {
listen *:80;


server_name domain.fr www.domain.fr subdomain.domain.fr;

root /var/www/domain.fr/web;

if ($http_host = "subdomain.domain.fr") {
rewrite ^(?!/\b(bar|stats|error)\b)/(.*)$ /bar/$2 last;
}


index index.html index.htm index.php index.cgi index.pl index.xhtml;



error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
recursive_error_pages on;
location = /error/400.html {
internal;
}
location = /error/401.html {
internal;
}
location = /error/403.html {
internal;
}
location = /error/404.html {
internal;
}
location = /error/405.html {
internal;
}
location = /error/500.html {
internal;
}
location = /error/502.html {
internal;
}
location = /error/503.html {
internal;
}

error_log /var/log/ispconfig/httpd/domain.fr/error.log;
access_log /var/log/ispconfig/httpd/domain.fr/access.log combined;

location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location /stats/ {

index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client0/web5/web/stats/.htpasswd_stats;
}

location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}

location ~ \.php$ {
try_files /95c54bbc57ae02e6bba619001d015e75.htm @php;
} location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web5.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
}

So if host is subdomain.domain.fr, then the url is rewrite to subdomain.domain.fr/bar/

Then now if in bar i have foo

if i try to reach http://subdomain.domain.fr/foo/ then ok
if i try to reach http://subdomain.domain.fr/foo then i'm redirect to http://subdomain.domain.fr/bar/foo/ NOT ok

Thanks for your help !
Best regards,
Nico
Subject Author Posted

rewrite rules issue

nicocolt April 18, 2015 04:08PM

Re: rewrite rules issue

Francis Daly April 18, 2015 05:04PM

Re: rewrite rules issue

nicocolt April 19, 2015 04:06AM

Re: rewrite rules issue

Francis Daly April 19, 2015 07:06AM

Re: rewrite rules issue

nicocolt April 19, 2015 09:53AM

Re: rewrite rules issue

Francis Daly April 19, 2015 06:52PM

Re: rewrite rules issue

nicocolt April 20, 2015 04:12AM

Re: rewrite rules issue

Francis Daly April 20, 2015 09:06AM

Re: rewrite rules issue

nicocolt April 21, 2015 09:26AM

Re: rewrite rules issue

Francis Daly April 21, 2015 04:50PM

Re: rewrite rules issue

nicocolt April 22, 2015 02:35PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 226
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