H
H
Hugger2015-07-10 14:21:58
htaccess
Hugger, 2015-07-10 14:21:58

What does the $ sign mean in an htaccess file?

RewriteRule flymail-([0-9]+).png core/flymail.php?id_mess=$1
RewriteRule ^login.html$ index.php?op=account&act=login
RewriteRule ^logout.html$ index.php?op=account&act =logout
RewriteRule ^register.html$ index.php?op=account&act=register
RewriteRule ^newpass.html$ index.php?op=account&act=newpass
RewriteRule ^accept,([0-9]+),([-a- zA-Z0-9_=]+)$ index.php?op=account&act=newpass&accept=yes&usid=$1&hash=$2
RewriteRule ^accept_rules.html$ index.php?op=cpanel&act=accept_rules
RewriteRule ^profile.html$ index.php ?op=cpanel&act=profile
RewriteRule ^cpanel.html$ index.php?op=cpanel
RewriteRule ^cpanel-p([0-9]+).html$ index.php?op=cpanel&page=$1
RewriteRule ^cpanel-([0-9]+)-edit.html$ index.php?op=cpanel&group=edit&id_mess=$1
RewriteRule ^cpanel-([0-9]+)-del.html$ index.php?op =cpanel&group=del&id_mess=$1
RewriteRule ^cpanel-([0-9]+)-prolongation.html$ index.php?op=cpanel&group=prolongation&id_mess=$
1 sent via RewriteRule ^...?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Optimus, 2015-07-10
Pyan @marrk2

Well, in order to take the dollar sign in the text, it must be escaped regexr.com/3bc7r without a screen, only the end of the line

S
ShamblerR, 2015-07-13
@ShamblerR

$ can be used in two ways
1. end of string e.g. ^string$ start-string-end
2. when you replace text e.g
.:
unnecessary_part of string(required_part of_string) again_unnecessary
in this case
$1 will return the contents of the first parentheses, every subsequent parentheses in the regular expression will give the next bucks at the output
in this option will be the following,
. You also need to understand that not all redirects can work with regular expressions. for example, the classic 301 is just a string redirect, in its case it will return the number $1 and will also consider $ at the end of the usual $
if you make a two-level construction

RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Then note that there is $ and %1 in the final url, since $1 is the first group in the RewriteRule, and %1 in the RewriteCond
There is nothing more to add about bucks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question