ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: "Anatoly A. Ivanov" <anatol@fxp.ru>
To: community@altlinux.ru
Subject: [Comm] Помогите сделать правило для mod_rewrite
Date: Thu, 9 Dec 2004 09:51:51 +0300
Message-ID: <1644100871.20041209095151@fxp.ru> (raw)

Здравствуйте, community.

Продолжая тему про формировании кривых адресов, столкнулся с
проблемами :)

Задача:
Нужно из адреса следующего типа:  www/secret_code/file1
выдрать secret_code, передать в скрипт, проверить по БД, если
действительный,  то отадть клиенту правило, которое сделает внутрений редирект на

www2/trash/file1

если код плохой, шлем клиента на

www/403

при чем url в броузере или качалке должен быть выглядеть как в варианте 1


Делаю:

согласно документации (самый простой вариант) сделал правило:

RewriteEngine on
RewriteMap    d-map       prg:/map.pl
RewriteRule   ^/access/(.*)/(.*).txt$  /access/${d-map:$1}/$2.txt [PT]

Согласно логике, как понимаю я, при доступе к папке /access/xyz/file1.txt, клиент
должен перенаправиться в папку /access/d2/file1.txt

Для этого сделал скрипт, по аналогии с документацией:

#!/usr/bin/perl
while (<>) {
    print "d2\n";
}
~

НО
ничего такого у меня не происходит :(

При доступе к любой папке внутри access в которых лежат файлы 1.txt

Броузер выдает:
 /access//1.txt  Not Found

 При чем, если пытаюсь обратиться
 к
 /access/d1/1.txt
 в броузере мне приписывается конеченый слеш, в результате:
 The requested URL /access/d1/1.txt/ was not found on this server.



 Помогите заставить работать RewriteMap, чтоб я смог усложнить этот
 скриптик.

Спасибо.



                 reply	other threads:[~2004-12-09  6:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1644100871.20041209095151@fxp.ru \
    --to=anatol@fxp.ru \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git