× Here you can get community support related to ReDJ.

Using preg_match on the URL to move from a folder

  • cyberwizzard
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 2 months ago #1514 by cyberwizzard
I used to have my website at mydomain.com/site/ and I switched over to a new installation in the root of the domain. So mydomain.com/site/my-blog will become mydomain.com/my-blog.

I tried 'Request Only' with '^/site/.*$' and without it as 'mydomain.com/site/.*' and both seem to trigger ReDJ.

However, I am stuck on the rewriting part: I set 'To URL' as 'http://{siteurl}/{preg_match 1}/\/site\/(.*)/{/preg_match}'
Going to mydomain.com/site/my-blog results in a 404 and ends up at 'mydomain.com/{preg_match 1}/\/site\/(.*)/{/preg_match}'

I also tried using the placeholders by defining one as:
'part={preg_match 1}/\/site\/(.*)/{/preg_match}' and setting the 'To URL' field as 'http://{siteurl}/{part}'. I then end up at 'mydomain.com/{part}' which of course is another 404 error...

Am I doing something wrong?

Please Log in or Create an account to join the conversation.

  • cyberwizzard
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 2 months ago #1516 by cyberwizzard
Replied by cyberwizzard on topic Using preg_match on the URL to move from a folder
I found someone with a similar problem and your solution to use 'pathltrim'. Am I missing the location of online documentation or is this not available?

The solution was:
From URL: ^/site/
To URL: http://{siteurl}/{pathltrim /site/}{queryfull}
Request only: true (must be checked)

I am still curious why the regular expression is not evaluated though...

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #1518 by admin
Hi,
the reason is preg_match is a macro available only in the Enterprise version, while you are using the Community version. You can find a quick gude in the download section, and under "Documentation" in the next future.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • cyberwizzard
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 2 months ago #1519 by cyberwizzard
Replied by cyberwizzard on topic Using preg_match on the URL to move from a folder
That explains a lot.

I saw under the feature comparison chart that "Use of regular expressions to specify matching source URLs" was also for the Community Edition and figured this would mean preg_match would work...

Thanks for the clarification.

Please Log in or Create an account to join the conversation.

More
11 years 2 months ago #1521 by admin
Is correct, but {preg_match} is not part of regular expressions (related to source URLs), but of macros (build of destination URLs):
Use of macros to specify destination URL (dynamic destination URLs)

And, as reported, there are 28 macros available in the Community and 35 macros in the Enterprise.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.157 seconds