Welcome! Log In Create A New Profile


Stuck with rewrite rules

Posted by nielsenp 
Stuck with rewrite rules
October 28, 2011 08:34AM

I'm stuck trying to make some rewrite rules.

The goal is to transform :

1) <domain>/part1+++part2.php to <domain>/part1/part2.php
2) <domain>/part1+++part2+++part3.php to <domain>/part1/part2/part3.php

So far I have come up with two rules to match the urls, but when using rewrite I get 404's and the links on the page is not rewritten.

I have tried both these options:

if ($request_uri ~* "^(.*)(\+{3})(.*)$")
rewrite ^(.*)$ $1/$3 last;

or just a : rewrite "^(.*)(\+{3})(.*)$" $1/$3 last;

for 2) I use "^(.*)(\+{3})(.*)(\+{3})(.*)$" as the regex.

Can anyone please help me out here ?
What am I doing wrong ?
Re: Stuck with rewrite rules
October 29, 2011 10:48PM

This may sound like a silly question to a question but..
Are you sure you have the rewrites under the correct "location"? Example "location /"
Also, try adding a forward slash (/) with the rewrite rules like so: rewrite ^/(.*)(\+{3})(.*)(\+{3})(.*)$ /$1/$3 last;

If all of about fail, I'm not sure what to suggest...
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 160
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready