Apache redirect with RewriteCond not working - apache

I am looking a way to rewrite the below url:
faleconosco.aeiou.com.br/Email.do?tela=2&auth=N&skin=Sac
to
10.13.2.1:9080
I already tried several differents ways: All not worked
Any help will be glad
RewriteCond %{REQUEST_URI} =contact/Email\.do?tela=2&auth=N&skin=Sac [NC]
RewriteRule http://10.13.2.1:9080 [R=301,L]
RewriteCond %{HTTP_HOST} =faleconosco.aeiou.com.br/contact/Email.do?tela=2&auth=N&skin=Sac
RewriteRule ^(.*)$ 10.13.2.1:9080/$1 [R=301]
RewriteCond %{HTTP_HOST} (a-z).aeiou.com.br/contact/Email.do?tela=2&auth=N&skin=Sac
RewriteRule ^(.*)$ 10.13.2.1:9080/$1 [R=301]
Any assistance will be glad

Related

Redirection subdomain

I was trying now for hours to get it working but without a solution.
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{HTTP_HOST} ^forum\.rainingdreams\.to
RewriteRule ^(.*)$ https://rainingdreams.to/forum/$1 [R=301]
This is the .htaccess that I use. I have the problem, that the subdomain fetches the folder wrong. If I enter "forum.rainingdreams.to" it will fetch "forum.rainingdreams.to/forum/". I just want that the subdomain will redirect it to the folder.
Does anyone have an Idea?
You can use:
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{HTTP_HOST} ^forum\.rainingdreams\.to
RewriteRule ^((?!forum).*)$ /forum/$1 [L]

Multiple domains on one host https and http

I have multiple domains on one host, my .htaccess looks like this
RewriteEngine On
RewriteCond %{HTTP_HOST} web1.com$ [NC]
RewriteCond %{REQUEST_URI} !^/web_1/public/.*$
RewriteRule ^(.*)$ /web_1/public/$1 [L]
RewriteCond %{HTTP_HOST} web2.com$ [NC]
RewriteCond %{REQUEST_URI} !^/web_2/public/.*$
RewriteRule ^(.*)$ /web_2/public/$1 [L]
And it works so far. Now I want only web1.com, not web2.com, to redirect to https. How do I have to change the settings? (I am also thankful for tips about how to change my "implementation" so far, I am new to .htaccess and willing to learn more about it)
Try this :
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} web2.com$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
So , your rules will look like this :
RewriteEngine On
RewriteCond %{HTTP_HOST} web1.com$ [NC]
RewriteCond %{REQUEST_URI} !^/web_1/public/.*$
RewriteRule ^(.*)$ /web_1/public/$1 [L]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} web2.com$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
RewriteCond %{HTTP_HOST} web2.com$ [NC]
RewriteCond %{REQUEST_URI} !^/web_2/public/.*$
RewriteRule ^(.*)$ /web_2/public/$1 [L]

.htaccess domain-1/directory-x to domain2.directory-y

How would I, with .htaccess, do the following
RewriteCond %{HTTP_HOST} ^(www.)?domain-1\.com$ [NC]
RewriteCond %{REQUEST_URI} /posts/([a-z0-9_]+)
RewriteRule ^(.*)$ https://www.domain-2\.com/articles/$1 [L,R=301]
So that "/posts/" does not become part of the forwarded path?
Example, I want
http://www.domain-1.com/posts/2014/06/17/some-post-title
To forward to
https://www.domain-2.com/articles/2014/06/17/some-post-title
Thank you for any help.
You can use:
RewriteCond %{HTTP_HOST} ^(www\.)?domain-1\.com$ [NC]
RewriteRule ^posts/(.*)$ https://www.domain-2.com/articles/$1 [L,R=301,NE]

Help with mod_rewrite rule

Need a little help getting the following rule working:
RewriteCond %{HTTP_HOST} ^asset.*.domainone\.com [NC,AND]
RewriteCond %{REQUEST_URI} !^/FILE/.* [NC]
RewriteRule ^(.*)$ "http://domaintwo\.com/$1" [L]
For requests coming to this server with a domain of 'asset(anything).domain.com' which does not start with 'FILE', redirect to another server.
Thanks.
RewriteCond %{HTTP_HOST} ^asset.*?\.domainone\.com [NC]
RewriteCond %{REQUEST_URI} !^/FILE/.* [NC]
RewriteRule ^/(.*)$ http://domaintwo.com/$1 [R,L]

Redirect with .htaccess

i have a pointed domain keepyourlinks.com on my cpanel of piscolabis.info, so if you go to piscolabis.info/keepyourlinks.com/ you acces it and i don't want that, i'm trying:
RewriteCond %{HTTP_HOST} ^piscolabis.info/keepyourlinks.com/ [NC]
RewriteRule ^(.*)$ http://keepyourlinks.com/$1 [L,R=301]
But it doesn't work... :S
This should work:
RewriteCond %{HTTP_HOST} ^piscolabis.info$
RewriteCond %{REQUEST_URI} ^/keepyourlinks.com [NC]
RewriteRule ^(.*)$ http://keepyourlinks.com/$1 [L,R=301]