Diggbar modrewrite. How do they pass urls through modrewrite?

With the new Diggbar, you can put http://digg.comin front of any URL you are currently on and create a short Digg URL. I just assume that they are doing this modrewrite (although I'm not sure, since I'm new to this).

How it's done? I think when I try this from the website I'm working on, it is bombing.

I want to be able to do the following:

http://example.com/http://stackoverflow.com/question/ask

and have modrewrite that allows this to go to

http://example.com/index.php?url=http://stackoverflow.com/question/ask

But when I use this modrewrite:

RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ /message.php?id=$1 [L]

he does not work. What am I doing wrong?

+3
source share
2 answers

, Apache . URI /http://foobar/ /http:/foobar/. (THE_REQUEST) :

RewriteCond %{THE_REQUEST} ^GET\ /(https?://[^\s]+)
RewriteRule ^https?:/ index.php?url=%1 [L]
+5

, . index.php message.php htaccess;)

, - :

RewriteEngine on
RewriteRule ^http://(.+)$ /index.php?url=$1 [L]

, URL- , ! (, , example.com/index.php, .)

+1

Source: https://habr.com/ru/post/1707805/


All Articles