RewriteRule ^(?!cat$)([^/.]+)$ http://site.ru/cat/$1 [R=301,L]
String path="\\\\home\\book\\magazine\\out";
String path2="\\\\home\\book\\magazine";
if( path.startsWith(path2)
&& path.length() == path2.length()
|| path.startsWith("\\", path2.length())
){
System.out.println("find");
}
"\n"
символ новой строки"\t"
табуляция"\b"
backspace возврат на один символSystem.out.println("\\");
System.out.println("\\\\home\\book_store\\magazine");
\
тоже имеет специальное значение и его снова нужно удвоить. Так что в итоге String path="\\\\home\\book\\magazine";
String pattern="\\\\\\\\home\\\\book\\\\magazine(|\\\\.*)";
import java.util.regex.Pattern;
String path="\\\\home\\book\\magazine";
String pattern="\\\\home\\book\\magazine";
pattern = Pattern.quote(pattern).concat("(|\\\\.*)");
server {
listen 80;
listen [::]:80;
root /var/www/mysite/public;
index index.php index.html;
server_name mysite.ru;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
}
server {
listen 80;
listen [::]:80;
root /var/www/mysite/public;
index index.php index.html;
server_name api.mysite.ru;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_param REQUEST_URI /api$request_uri;
fastcgi_param HTTP_HOST mysite.ru;
}
}
server {
listen 80;
listen [::]:80;
root /var/www/mysite/public;
index index.php index.html;
server_name mysite.ru;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
}
server {
listen 80;
listen [::]:80;
server_name api.mysite.ru;
location / {
proxy_pass http://127.0.0.1/api/;
proxy_set_header Host mysite.ru;
}
}
<IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^potolkirostov.ru RewriteCond %{HTTPS} off RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_URI} ^(.*)/index\.(php|html)$ RewriteRule ^(.*)$ %1/ [R=301,L] RewriteCond %{THE_REQUEST} // RewriteRule .* /$0 [R=301,L] </IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)/index\.(php|html)$
RewriteRule ^(.*)$ https://potolkirostov.ru%1/ [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://potolkirostov.ru/$1 [L,R=301]
RewriteCond %{THE_REQUEST} //
RewriteRule .* https://potolkirostov.ru/$0 [R=301,L]
</IfModule>
RewriteCond %{THE_REQUEST} "^[^ ]* .*?\.php[? ].*$"
/news/a?=$1
на /news?a=$1
RewriteRule ^news/(\w+)$ /news?a=$1 [L]
RewriteRule ^news/(\w+)$ /news.php?a=$1 [L]
С какой ссылки на какую нужен редирект?