last day (14 days later) » 

1:45 AM
1
A: nginx: Multiple cross-domain 301 redirects with different page addresses

CroisesYou can use that: RewriteEngine On RewriteCond %{REQUEST_URI} ^/$ RewriteCond %{QUERY_STRING} ^dct=([a-z]+)_expediting$ [NC] RewriteRule .* https://www.dcturano.com/%1/ [QSD,R=302,L] RewriteCond %{HTTPS} off RewriteRule .* https://www.dcturano.com%{REQUEST_URI} [R=302,L] Explanations: 1) Te...

 
Could you explain what's happening in the 3rd and 4th lines? Re: 3rd line, how does the condition pick up the dcturanoinc.com domain? Re: 4th line, I don't quite understand what the /%1/ part is doing there.
 
No problem ! I will add explanations in my message.
 
Thank you so much for the clarification Croises! Regarding the forwarding of http to https, take a look at the last section of the edit I made (it begins with if ($scheme = http)). Is that sufficient, or should I remove that and add the section you created that begins with RewriteCond %{HTTPS} off?
 
For me, it's easier later, if everything is in the same place, in .htaccess file
 
And basically %{HTTPS} off says "if https is off, do the following"?
 
1:45 AM
That's exactly right
 
One more thing: How does your block know to redirect dcturanoinc.com in particular?
 
You can add one RewriteCond %{HTTP_HOST} ^(?:www\.)?dcturanoinc\.com$ before 1). But I don't, because you only use ?dct= in dcturanoinc.com and it's my test...
 
Hey Croises
 
sorry, first time for me in this chat, and bad english...
 
Your english is fine!
 
1:46 AM
thanks ;-)
 
With that last question, I didn't understand how the block would know to redirect from dcturanoinc.com. Does it know because the domain registrar is forwarding the domain to the server?
 
I test with ?dct= with is not in the new url
if i see ?dct= I need to redirect
 
How would I direct for the home page in this block? Because we haven't established that I think
 
for the home page, it's just with the domain name, right ?
 
Correct
 
1:51 AM
You don't ask for that in your question :-)
 
I just realized that ;(
Totally forgot that, my apologies!
 
if the old site was http, the https redirect do the work
 
We don't need to specify dcturanoinc.com? What I'm trying to say is how does the server know it has to redirect the dcturanoinc.com domain?
 
Just 1 minute I give you code for that
 
Thanks!
 
1:58 AM
RewriteCond %{HTTP_HOST} ^(?:www\.)?dcturanoinc\.com$
RewriteRule (.*) https://www.dcturano.com/$1 [R=301,L]

Put that after the others
RewriteCond %{HTTP_HOST} ^(?:www\.)?dcturanoinc\.com$
RewriteRule (.*) htt ps://w ww.dcturano.com/$1 [R=301,L]
 
All of the others?
 
That was not right, y just ad space in htt p and www you can delete them
The oders in the question before chat
 
This is what I have now:
server {
listen 80;
listen [::]:80;
listen 443 default_server ssl;

server_name dcturano.com www.dcturano.com;

# Forward dcturanoinc.com

RewriteEngine On;
RewriteCond %{REQUEST_URI} ^/$;
RewriteCond %{QUERY_STRING} ^dct=([a-z]+)_expediting$ [NC];
RewriteRule .* https://www.dcturano.com/%1/ [QSD,R=301,L];

RewriteCond %{HTTPS} off;
RewriteRule .* https://www.dcturano.com%{REQUEST_URI} [R=301,L];

RewriteCond %{HTTP_HOST} ^(?:www\.)?dcturanoinc\.com$;
RewriteRule (.*) dcturano.com$1 [R=301,L];
 
Yes, its that for me, and I hope that work for you
 
For some reason the server is failing to restart with that code, I'll have to run through it and figure out what's causing it
Nothing in there would should prevent the server from restarting, yes?
 
2:03 AM
Sorry, I don't know. I just see you don't put that in .htaccess fil ?
 
nginx doesn't use htaccess files, only nginx.conf
 
I did not know that. I use a disk cache version on my Linux server, and it also uses the Apache .htaccess ...
 
I think all of that was for apache, not nginx
 
You use .htaccess tag in your question... And like I use .htaccess with nginx cache on my apache server...
 
I didn't know that was possible to use nginx cache with apache, again my mistake
 
2:08 AM
I just hope you don't lost your time with me :-(
 
Not a worry at all, I really appreciate you trying to help, its very kind of you
Its my fault for not being more specific
 
Thank you ! Bye !
 
Thank you again Croises, take care!
 

last day (14 days later) »