B.R.
May 06, 2016 07:46AM
There is plenty of information around here for you to start.
Instead of coming here for pre-cooked recipes, you should show you at least
tried...

You could read the
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html docs
<http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return> or some
tutorials from quality sources
https://www.nginx.com/blog/creating-nginx-rewrite-rules/.

Since I am in a good mood, Apache redirect rule #2 *might* (note emphasis)
transform into this:
location ~* ^/s/(?<source>.*)$ {
return 301 /audio_redirect_source.php?u=$source;
}

​Why are you providing backend code again?​ It really feels like 'I do not
understand how the whole thing works and/or I have not thought about that
stuff at all, please do it for me'.
---
*B. R.*

On Thu, May 5, 2016 at 10:25 AM, Christian Ivanov <
christianivanov2016@gmail.com> wrote:

> Hello there. I want to migrate my website only on nginx. I setup
> everything, but have issue with my htaccess.
>
> Here is the file:
>
> [root@server]# cat .htaccess
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteRule ^audio-(.*)\.html$ %{ENV:BASE}/audio_redirect_mask.php [L]
> RewriteRule ^s/(.*)$ %{ENV:BASE}/audio_redirect_source.php?u=$1 [L]
> </IfModule>
> [root@server]#
>
> Somebody to have good idea, how can I replace this htaccess and execute
> rewrite, without mod_php with apache or php-fpm?
>
> Here is the source of both PHP files:
>
> ------------------------------------------------------------------------------------------------------------
>
> [root@server]# cat audio_redirect_mask.php
> <?php
>
> if (empty($_GET['j'])) {
> $url = '/';
> } else {
> $str = str_replace(array('-', '_'), array('/', '+'), $_GET['j']);
> $url = '/s/' . base64_encode(openssl_decrypt($str, 'AES-256-CBC',
> 'somesecretpassword2222', 0, '1234567891011121000'));
> }
>
> header("location: $url", true, 302);
>
> ------------------------------------------------------------------------------------------------------------
>
> [root@server]# cat audio_redirect_source.php
> <?php
>
> if ($_GET['u']) {
> header("X-Robots-Tag: noindex", true);
> header('Location: ' . base64_decode($_GET['u']) , true, 302);
> } else {
> header("X-Robots-Tag: noindex", true);
> header("location: /");
>
> ------------------------------------------------------------------------------------------------------------
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Replace apache with nginx

Christian Ivanov May 05, 2016 04:26AM

Re: Replace apache with nginx

B.R. May 06, 2016 07:46AM

Re: Replace apache with nginx

Francis Daly May 10, 2016 05:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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