$str = '1234145577';
$mask = '+7(###)###-##-##';
$i = 0;
$result = preg_replace_callback(
'/#/',
function ($m) use ($str, &$i) {
return $str[$i++] ?? $m[0];
},
$mask
);
echo $result;
<a [^>]*href="https://www\.youtube\.com/watch\?v=([^"&]+)[^>]*>(?s:.*?)</a>
<iframe width="560" height="315" src="https://www.youtube.com/embed/$1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
location ~ ^/(test/[^/]+)/test2/$ {
return 301 /$1/;
}
rewrite ^/(test/[^/]+)/test2/$ /$1/ permanent;
RewriteEngine On
RewriteCond %{REQUEST_URI} !/$ [OR]
RewriteCond %{THE_REQUEST} ^[^?]+(?://|--)
RewriteCond $1 ^(.*-)-(.*)$|(.*)
RewriteRule ^([^.]+?)/?$ https://www.soskin.com.ua/%1%2%3/ [R=301,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.soskin.com.ua/$0 [R=301,L]
RewriteRule "^articles/ (текст вначале списка продукции)/$" /articles/ [R=301,NC,L] RewriteRule ^articles/\ (текст\ вначале\ списка\ продукции)/$" /articles/ [R=301,NC,L]
RewriteRule "^articles/ \(текст вначале списка продукции\)/$" /articles/ [R=301,L]
RewriteRule ^articles/\ \(текст\ вначале\ списка\ продукции\)/$ /articles/ [R=301,L]
RewriteRule ^articles/%20%28%D1%82%D0%B5%D0%BA%D1%81%D1%82%20%D0%B2%D0%BD%D0%B0%D1%87%D0%B0%D0%BB%D0%B5%20%D1%81%D0%BF%D0%B8%D1%81%D0%BA%D0%B0%20%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%86%D0%B8%D0%B8%29/$ /articles/ [R=301,NC,L]
RewriteCond %{THE_REQUEST} "^\S+ /articles/%20\(%D1%82%D0%B5%D0%BA%D1%81%D1%82%20%D0%B2%D0%BD%D0%B0%D1%87%D0%B0%D0%BB%D0%B5%20%D1%81%D0%BF%D0%B8%D1%81%D0%BA%D0%B0%20%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%86%D0%B8%D0%B8\)/[ ?]"
RewriteRule ^ /articles/ [R=301,L]
AuthName "Please enter your credentials. Website is available only to authorized users."
AuthType Basic
AuthUserFile /var/www/html/master/.htpasswd
<RequireAny>
Require valid-user
Require expr %{THE_REQUEST}=~m#^\S+\s/api#
</RequireAny>
AuthName "Please enter your credentials. Website is available only to authorized users."
AuthType Basic
AuthUserFile /var/www/html/master/.htpasswd
Require valid-user
Satisfy Any
SetEnvIf Request_URI ^/api api_allow=1
Order Allow,Deny
Allow from env=api_allow
Allow from env=redirect_api_allow
Страница выдала "слишком много перенаправлений"
RewriteEngine On
RewriteRule ^(.*)$ https://new-domain.ru/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.ru$ [NC]
RewriteRule ^(.*)$ https://new-domain.ru/$1 [R=301,L]
https://old-domain.ru
на https://new-domain.ru
([a-z])([A-Z])
$1, $2
(?|([a-z])([A-Z])|([а-яё])([А-ЯЁ]))
$1, $2
// remove HTML comments (not containing IE conditional comments).
$this->_html = preg_replace_callback(
'#<!--(?!/?noindex)(.*?)-->#s'
,array($this, '_commentCB')
,$this->_html);
RewriteEngine On
добавить RewriteRule ^index\.php/(.*) http://site.local/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* http://site.local/$0 [R=301,L]
(?i:у()|х()|й()|\w)++\1\2\3
\b(?=\w*?у)(?=\w*?х)(?=\w*?й)\w+