apache: help with 301 redirection of subdomain to root domain

To redirect requests from sub.example.com/uri to example.com/uri:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.example.com$
RewriteRule ^(.*)$ http://example.com/$1 (R=301,L)

To redirect requests from sub.example.com/uri to example.com:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.example.com$
RewriteRule ^(.*)$ http://example.com/ (R=301,L)

htaccess: what should I do with penalized websites that have been 301 redirected to mine?

You should not reject anything unless you know that those links are causing ranking issues or penalties for their content. In most cases, Google already knows that those domains are spam and completely ignores them. They will not harm your site when your competitor redirects them to you.

If you need to deauthorize, it is unclear whether you can deauthorize the redirect domain or do you need to deauthorize all the domains that bind to the redirect domain. It would certainly be easier to reject redirect domains. Google's John Mueller chimed in on a similar question about redirects and denials, but couldn't really answer it: https://www.youtube.com/watch?v=h0FC1K25Z3w&feature=share&t=28m34s I would start with refusing to redirect the domain and see if that improve the classification or lift the penalty.

In .htaccess you can launch a 403 Forbidden referrer based error. See How do you block a referrer but for a specific URL using .htaccess? Unfortunately, doing so isn't going to help much for two reasons:

  • Googlebot never sends a Referer header, so Googlebot won't know that it's trying to block links.
  • The redirect domain does not always appear in the Referer header. It will only do this for direct traffic to that domain. When someone on page A clicks a link to the redirect domain and is sent to your site, page A appears in the Referer, not the redirect domain.

301 redirect rewrite query string in .htaccess

RewriteRule ^/contact/?view=full$ /contact/ (R=301,L)

the RewriteRule model matches only the URL path, which notably excludes the query string. Therefore, the above directive will not match the required URL. To match the query string, you must use an additional condition and check with QUERY_STRING server variable

Also in .htaccess (directory context) the URL path that matches RewriteRule model does not start with a slash, because the directory prefix is ​​removed first from the matching URL model ends with a forward slash. Then again the directive will not match the requested URL due to the forward slash prefix.

Also, the request query string is copied to the substitution string by default, unless explicitly discard or create a new query string. So the above directive won't remove the query string either.

Try the following instead, near the top of your .htaccess archive:

RewriteCond %{QUERY_STRING} ^view=full$
RewriteRule ^(contact/)$ /$1 (QSD,R=302,L)

This matches the URL /contact/?view=full exactly. And redirect to /contact/. the QSD (Discard query string) indicator (Apache 2.4) in the RewriteRule directive discards the query string of substitution rope.

the $1 is a reference to the group captured in the RewriteRule modelthat is the value contact/. This simply saves typing / repetition.

Note that this is currently a 302 (temporary) redirect. If it is intended to be permanent, only change it to 301 once you have proven it works correctly. The browser caches all 301s persistently, so it can make testing problematic.

You must clear your browser's cache before testing.

Reference:

301 redirect to the robots.txt file to a different domain, it can be to a front layer of the cloud

I would like to know if I can put a 301 redirect in the robots.txt file and navigate to a different location.

sample site = https://www.example.net/robots.txt redirects to https://differentdomain.net/example/robots.txt

htaccess: can I use REGEX for 301 a URL with additional characters at the end?

I just set up PHPlist to manage my email subscribers.

When people subscribe, they are taken to this page:

https://www.example.com/lists/?p=subscribe&id=1

I would like to redirect them to a custom page here:

https://www.example.com/welcome

I tried 301 from / lists /? P = subscribe & id = 1 a / welcome, but this will not work. I guess this is due to the characters after / lists /.

And, I can't 301 from / lists to / welcome because / lists is the first part of the page to unsubscribe too.

Is there any way I can 301 from the previous full address with REGEX? Or is there another way to get people to a personalized page, without editing the PHP code base?

Thank you!

I will provide dofollow 301 redirects high authority links from 90 for $ 20

I will provide dofollow 301 redirects the high authority links of the authority of 90

I will provide dofollow 301 high redirection from 70 Da to 90 Da authority backlinks

Hello, my name is Ahtisham Ul haq and I am Seo Expert. I have gained a lot of success with my websites in recent years and that also due to the SEO skills that I applied. With great success comes a great responsibility So, here I am to help all people

How expired domain works

I will redirect your Money site to expire the domain All links Juice Pass your Money site. This process is safe accordingly. Google Y Moz and also your website improves the ranking of your site.

Website List:

  1. New York Time
  2. Wired dot com
  3. TechCruch
  4. Washington Post
  5. CNN
  6. Mashable
  7. ETC

Details:

  • The Domain Authority starts from Da-70 to DA-90
  • Permanent Link
  • FOLLOW
  • Only one or two links

SATISFACTION GUARANTEED:

✔ Feel free to contact me at any time

✔ 100% customer satisfaction guaranteed

.

apache – HTTPS Migration: 302 redirect instead of 301

I migrated my website from http: // whatever to https: // whatever, inserting these three lines at the beginning of my file & # 39; .htaccess & # 39 ;:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 (L,R=301)

However, if I analyze the HTTP headers of & # 39; http: // mydomain & # 39; (for example, using "curl -I http: // mydomain"), I see

HTTP/1.1 302 Found
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: https://mydomain

What am I doing wrong? Thank you.

Google search console: inspect the previous domain after performing 301 redirection

After redirecting to a new domain

I tried to inspect the URL of the previous domain of your webmaster and obtained this information

The URL is not in Google This page is not in the index, but not by
a mistake. See the details below to find out why it was not indexed. To learn
plus

enter the description of the image here

If so, then Why do I keep losing my rank in Google search?

Also, I would like to know what is the difference between the Reference page Y Canonical declared by the user?

vhost: 301 redirect for the "/ use" page while the webalizer is installed

I moved my site to another hosting provider and it is using webalizer. My site has a page called /usage.

While testing I discovered the page https://example.com/usage/ generates the 403 Forbidden error due to this webalizer.conf:

#
# This configuration file maps the webalizer log analysis
# results (generated daily) into the URL space.  By default
# these results are only accessible from the local host.
#
Alias /usage /var/www/usage


   # Alternative e.g. "Require ip 192.168.10"
   Require local

OK, I changed the name usage to some-usage and created a 301 redirect but apparently the configuration file has a higher priority.

My questions):
Can I be more specific in webalizer.conf and tell Apache to ignore /usage when that is in the https://example.com/usage/ context or how can I configure redirection 301 to work.

Personally, I would prefer the solution where Apache ignores /usage in the https://example.com/usage context.

ssl – 301 Redirect Loop www a non-www – Nginx + Apache2

Thanks for any help. I am not a server, but I am dealing with a server at the moment. I have a site that is in a redirect loop from www to non www. I am using a DigitalOcean Droplet with Ubuntu and Nginx for SSL. I originally had problems for SSL to work and I created a configuration based on this post in StackExchange: WordPress redirect loop in nginx + apache reverse proxy. The main difference I had made was to use a 302 redirect in the last block of the server. However, someone told me to change it to 301 and now I'm getting the loop from www to no www. Below is my configuration file.

server {
        server_name .mysite.com;
        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php index.html;

        gzip on;
        gzip_types application/javascript image/* text/css;
        gunzip on;

        location ~.(js|css|png|jpg|jpeg) {
                try_files $uri $uri/ =404;
        }

        location / {
                try_files $uri @apache;
        }

        location ~(^?)*/$ { # proxy directories
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:8080;
        }

        location ~ .php$ { # serve php files
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:8080;
        }

        location @apache { # used by location /
                proxy_set_header X-Real-IP  $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
                proxy_pass http://127.0.0.1:8080;
        }


        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /.ht {
                deny all;
        }

        listen (::):443 ssl ipv6only=on;
        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

}

server {
    listen 80;
    server_name _;
    return 301 https://$host$request_uri;
}

Note: changing 301 back to 302 did not solve the problem.

Please help, thanks!

Edit: I have also confirmed that there are no references to www.mysite.com in the database. I have used WP-CLI to find some. And the home and site URLs have always been without www.