Welcome! Log In Create A New Profile

Advanced

rewrite rules wanted

Posted by karthick62 
rewrite rules wanted
December 31, 2010 12:49AM
Hi

I need help in writing clean urls for my drupal sites. My set up is like this.

I have many subsites under document root. for which I can enable clean url as follows


server {
listen 80;
server_name nginx ; # your domain name
client_max_body_size 50M;
root /var/www/drupal; # your drupal site files

charset utf8;
source_charset utf8;
access_log /var/log/nginx/localhost.access.log; # log file path

location / { ######################################## 1
root /var/www/drupal/; # your drupal site files
index index.php;
if (!-e $request_filename) {
rewrite ^/subsite/$ /subsite/ permanent;
rewrite ^/subsite/(.*)$ /subsite/index.php?q=$1 last;
rewrite ^/(.*)$ /index.php?q=$1 last;
}

location /subsite1/ { ############################################ 2
root /var/www/drupal/;
index index.php;
if ($request_uri ~* ^.*/.*$) {
rewrite ^/(\w*)/(.*)$ /$1/index.php?q=$2 last;
break;
}
}

I want to combine rewrite urls for ###1 and ###2 and I have more than 15 subsites under subsite1. I dont want to add location directive { } for each and every subsite instead I want a rewrite rule which satisfies the clean urls in all the subsites under subsite1.

Thanks in advance.
Re: rewrite rules wanted
January 04, 2011 02:33PM
I use this site to test my regular expressions

http://www.fileformat.info/tool/regex.htm
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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