redirects – Multiple pages under single directory redirection to a single page

You are close, but there are errors:

RewriteRule ^ /. * $ ....

In .htaccess, the URL path corresponding to the RewriteRule model do not start with a slash, so this should be just ^. * $ (or even just . * – since regex is greedy by default), not ^ /. * $. By including the prefix slash, it will never match, so the directive does nothing. (You would need the slash prefix in a server or virtualhost the context.)

RewriteCond% {REQUEST_URI} ^ / page / product / New-Design / * [NC,OR]

the CondPattern (2nd argument to the RewriteCond directive) is a regex. The escape * it looks like you're treating as a joker expression. the * at the end, the preceding character is at least 0 times the preceding character. In this case, it corresponds to a slash equal to or more than 0 times. This does not correspond to the URLs you want to redirect. You should either use . * (to match 0 or more of any character: the point), or omit it completely, since it's enough to match the URLs starting with this path.

RewriteCond% {REQUEST_URI} ^ / page / product / New-Design / * [NC,OR]
RewriteCond% {REQUEST_URI} ^ / page / product / nature-of-purchase-design / * [NC,OR]
RewriteRule ^ /. * $ Https:// [R=302,L]

You should never include the OR flag on the last condition. That's basically saying OR true and the rule will run without condition (that is, if the RewriteRule model paired).

    RewriteCond% {REQUEST_URI} ^ / engine.jsp * [NC]
 RewriteRule ^ /. * $ Https:// [R=302,L]

the REQUEST_URI server variable does not contain the query string, so if you want to match all query string then you have nothing to do in this regard, you just need to match the required URL path. (To specifically match the query string, you need a condition that checks the REQUEST CHAIN server variable.)

In addition, wherever possible, it is more efficient to perform the necessary URL path checks in RewriteRule modelrather than using a RewriteCond (condition) directive. So, the above could be rewritten into one directive:

    RewriteRule ^ engine  .jsp $ [R=302,L]

Do not forget to escape the literal points in the regex. In your question, you indicated that this should be redirected to, do not, as you said here?

In summary

So, by bringing this together, try the following instead. Note that these guidelines must go before the WordPress front controller, at the top of the .htaccess file.

RewriteRule ^ page / product / (new-design | nature-of-purchase-design) / [NC,R=302,L]

RewriteRule ^ engine  .jsp $ [NC,R=302,L]

RewriteRule ^ page / product / (old model | nature-of-old-design-purchase) / [R=302,L]

Note that I removed the end-of-line anchor ($) of RewriteRule model. And changed the model in lower case, since you have the North Carolina (In no case) flag anyway.

UPDATE: To redirect only when a query string is present on the /engine.jsp The URL, you will need to add a condition to the middle rule that checks the REQUEST CHAIN server variable. For example:

RewriteCond% {QUERY_STRING}.
RewriteRule ^ engine  .jsp $ [NC,QSD,R=302,L]

The regex (one point) in the CondPattern ensures that the query string is present on the request.

UPDATE # 2: The QSD (Apache 2.4+) flag is required to ignore the query string of the redirected response.

redirects – canonical tags on form page redirection

I'm adding canonical tags to our website and I'd like to add them to the pages on which users can download guides, but depending on the user's settings, they could be redirected.

If they are cooked, they will go directly to the canonical URL, for example. / downloads / white paper

If they are a new user, they are redirected to a page with a form field to provide information before the download. This page has an event code in the URL / downloads / lituraturemain? event = ABC-123-DEF-456

What are the best practices for adding canonical tags in a situation like this?

rewrite mod – Apache redirects: multiple pages under a single directory redirection rule

I have the following scenarios for web page referrals

1) All pages under* and all the pages under*

should be redirected to

2) Pages like and should be redirected to . There are several pages with* who should be redirected to

3) All pages under* and all the pages under*

should be redirected to .

To implement the above scenarios, I tried the following redirection rules

            RewriteCond% {REQUEST_URI} ^ / page / product / New-Design / * [NC,OR]
   RewriteCond% {REQUEST_URI} ^ / page / product / nature-of-purchase-design / * [NC,OR]
   RewriteRule ^ /. * $ Https:// [R=302,L]

   RewriteCond% {REQUEST_URI} ^ / engine.jsp * [NC]
   RewriteRule ^ /. * $ Https:// [R=302,L]

   RewriteCond% {REQUEST_URI} ^ / page / product / Old-Design / * [NC,OR]
   RewriteCond% {REQUEST_URI} ^ / page / product / nature-of-olddesign-purchase / * [NC,OR]
   RewriteRule ^ /. * $ Https:// [R=302,L]

The rules are in .htaccess file . is a wordpress site but not with multisite functionality.

With the rules above, referrals do not occur. So, please suggest how to make the redirects work.

magento 2.3 redirects all product URLs without category paths to URLs with category paths

I want to redirect all product URLs without category paths to their category path URLs for SEO purposes.
Example – Redirect to

Please help.

Driver with switching problems with redirects between a reader and Google [on hold]

What is the IRQL driver code less than or equal in the Windows 10 program and is there a wizard program to run new software for the program set up and running?

htaccess – Attempt to create 1-1 redirects, exclude certain directories / files, and redirect all other traffic to a new website

You can not mix RewriteRule and RedirectMatch like that. You must implement redirects using another RewriteRule to make it work the way you want A rewrite rule can not prevent a redirect match from working. Instead, your rules should be:

RewriteEngine on

# Exclude files / directories from redirects

RewriteRule ^ (documents) ($ | /) - [L]

# Redirect specific files / pages to new locations

RewriteRule ^ page1.html $ [R=301,L]
RewriteRule ^ dir1 / page1.html $ [R=301,L]
RewriteRule ^ documents / awesome.pdf $ [R=301,L]

# Redirects anything that is not at the top of the home page

RewriteRule. * Https:// [R=301,L]

I would not suggest using the latter rule either. This is not a good user experience, nor a good SEO to redirect everything to the home page. It is best to use a rule to direct the URL to its exact equivalent:

RewriteRule (. *) Https://$1 [R=301,L]

redirects – Nginx + haproxy does not work without an end slash in the URL

Have a configuration like this:

haproxy is listening to 443 -> nginx is listening to 4545

It's on the Ubuntu server

For some reason, nginx fails if the URL does not have a final slash.
So works and fails

For example:

curl -v


301 Relocated Definitively

301 Relocated Definitively

nginx / 1.10.3 (Ubuntu)


curl -v

give the real answer (the website).

The haproxy configuration is:

tune.ssl.default-dh-param 2048
log / dev / log local0
log / dev / log local1 reviews
chroot / var / lib / haproxy
Statistics / Mode / Proxy / Administrateur Mode.sock Administrator Level 660
waiting time statistics 30s
haproxy user
haproxy group

# Default SSL material locations
ca-base / etc / ssl / certs
crt-base / etc / ssl / private
# I removed the default ciphers from this block of code because it was not
# coming out directly in stackexchange.

global log
option httplog
option dontlognull
timeout connect 5000
customer waiting time 50000
timeout server 50000

frontal ssl
tcp mode
tcp-request inspect-delay 5s
tcp-request content accepts if HTTP
# use_backend ssh if {payload (0,7) -m bin 5353482d322e30}
use_backend main-ssl if {req.ssl_hello_type 1}
default_backend openvpn

backend main-ssl
tcp mode
main-ssl server

backend openvpn
tcp mode
server timeout 2h
openvpn-localhost server

The relevant nginx configuration is:

server {
listen to ssl;
# Redirect non-https traffic to https
if ($ scheme! = "https") {
return 301 https: // $ host $ request_uri;
# if a visitor goes to the root, and only to the root,
# we redirect
location / {
rewrite ^ (. *) $ permanent;
# I have several definitions like this one, and only this one:
location / mydir {
alias / home / abcdefg / public_html;
location ~ [^/] .php (/ | $) {
if (! -f $ request_filename) {
return 404;
include / etc / nginx / fastcgi_params;
fastcgi_index index.php;
fastcgi_split_path_info ^ (. + . php) (/.+) $;
fastcgi_param SCRIPT_FILENAME $ request_file_name;
fastcgi_pass unix: /var/run/php/php7.0-fpm.sock;

I've read 452 FAQs and several articles that seem to relate to the same problem, but in almost all of them, they redirect without haproxy or just have a misconfiguration (like they used a base URL with a trailing slash). the config).

This person seems to have had exactly the same problem, but it's because haproxy was not compiled with ssl support.

haproxy -vv output:

HA-Proxy version 1.6.3 2015/12/25
Copyright 2000-2015 Willy Tarreau 

Construction options:
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror = format-security -Wdate-time -D_FORTIFY_SOURCE = 2

Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Encrypted password support via crypt (3): yes
Built with zlib version: 1.2.8
Supported compression algorithms: identity, deflate, raw deflate, gzip
Built with the OpenSSL version: OpenSSL 1.0.2g March 1, 2016
Running on the OpenSSL version: OpenSSL 1.0.2g March 1, 2016
OpenSSL library supports TLS extensions: yes
OpenSSL library supports SNI: yes
OpenSSL library supports server preference ciphers: yes
Built with the PCRE version: 8.38 2015-11-23
PCRE library supports JIT: no (USE_PCRE_JIT undefined)
Built with Lua version: Lua 5.3.1
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND

Available voting systems:
epoll: pref = 300, OK test result
poll: pref = 200, OK test result
select: pref = 150, test result OK
Total: 3 (3 usable), will use epoll.

I've tried adding a / to the location and an alias to no avail. I've also tried modifying the redirection (although I should not hit the redirect). Finally, I curl with and without https with the same result, which leaves me a little puzzled by the current problem. Any entry would be appreciated.

redirect – Redirects and rewrites to the subdomain

I am currently working on a new WordPress website, to partially replace a non-WP website that includes an online store. At present, it is planned to migrate the online store and all the corresponding pages (purchase card, order confirmation page, etc.) to a subdomain, while retaining the informative pages (like About of us and Contact) in the main directory. These informative pages of the main directory will be replaced by WordPress pages containing exactly the same URLs (a page is the exception).

Fortunately, I am not responsible for the migration, but I have been instructed to write the correct redirects … and that 's where I am stuck.

In short, all the new website would be configured as follows:

What I've had up to here is this:

# Redirect this page to a new url
Redirect 301 / privacy-statement

# Make sure these pages and their children are not redirected
RewriteEngine on
RewriteCond% {REQUEST_URI}! ^ / About-us /(.*)
RewriteCond% {REQUEST_URI}! ^ / Contact /

# Redirect the rest to the new subdomain
RewriteRule (. *) Https://$1 [R=301,L]

I am not sure if this is correct … Can any one confirm whether it is correct or give a hint on what I should change?

Thank you very much in advance for any help!

Web server – Redirects users to the web server based on the IP of the user

I have a web server that has Windows authentication, I want to disable Windows authentication locally, anyone on the local network can access it without authentication. After much research, I found no way. But, I think I can create two web servers that use the same domain name, one used locally and one with a public IP address. but the question of how will I redirect local users to the local web server?

htaccess – 301 Redirects what do we do ([a-z]+) – (. *) and ([0-9]+) – (. *) means

I just checked a .htaccess file with custom redirects. There are two redirects that I do not understand perfectly:

RedirectMatch 301 ^ / news / ([0-9]+) - (. *) / blog
RedirectMatch 301 ^ / news / ([a-z]+) - (. *) / $ / blog / $ 1

Both redirects redirect the subfolders or pages of the news directory, but I can not understand how because I do not understand the following parts "[0-9]+) – (.) "and" ([a-z]+) – (.What do they mean exactly?

Thank you very much for your help and best regards.