Hot answers tagged

9

Google Webmaster Tools treats HTTP and HTTPS as separate sites. When adding a site, simply type the URL including the https:// prefix. You will then have two sites in Google Webmaster Tools. This fits with the general principle that http://www.example.com is considered a different URL from https://www.example.com and may validly serve different content, ...


9

You can make any file dynamic. The best way to do so is not through redirects, but through rewrite rules. RewriteRule ^robots\.txt$ /robots.php [L] That way, you power it with a dynamic script, but the URL doesn't change. Most crawlers (including Googlebot) will follow redirects for robots.txt, but some crawlers will get confused if you introduce ...


7

You most certainly do not have to buy store.xyz.com as a new domain name. store.xyz.com is a part of xyz.com A domain name is made up of multiple parts www.google.com www.google.com | | | --- domain name extension | | --- domain name | --- subdomain mail.google.com mail.google.com | | | --- domain name extension | | --- ...


6

Splash screens are acceptable according to Google. They do offer some best practices however, when using multi-language/multi-regional sites. In this article, Google recommends the use of the hreflang tag within <link rel="alternate" ... /> tag in the head. The specific excerpt from the article is below: For language/country selectors or ...


5

Use this. It should save you from two headaches. RewriteEngine On RewriteCond %{HTTP_PORT} 80 [OR] RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ https://example.com/$1 [R=301,L] this also allows any URL that starts with http://www.example.com/ or that connects to port 80 (the standard web port) to redirect to https://example.com/


5

I changed the DNS so it's the same as my website Does this mean your website is now displaying on their domain? If so undo this ASAP, as this will create a duplicate of your site, which could have na adverse effect on your sites ranking. You should 301 redirect their domain to your domain. Where possible redirect pages on their site to relevant pages ...


5

Will the submitted data be secured and encrypted normally? Yes, when the data is submitted from HTTP to HTTPS (via the form's action attribute), the data will be sent via an encrypted connection. However, the user will probably be unaware of this, so the "user trust" that HTTPS provides is non-existent. ...that redirects back to HTTP? The ...


5

You can't do a simple redirect of "all articles" if the source and destination IDs in the URL are different and there is no easy way to map between the two. For example, how do we know that 966aaafd8 maps to 8a4521384? In order to do this you would need to create a RewriteMap in your server config (containing all the source / destination IDs) or rewrite ...


4

Actually I just found an answer to my own question addressed in the relevant RFC 7230 (or its predecessor RFC 2616), e.g. in the description of status code "303 See Other": Except for responses to a HEAD request, the representation of a 303 response ought to contain a short hypertext note with a hyperlink to the same URI reference provided in the ...


4

The software 'WebsitePanel' does not allow you to make subdomains of a subdomain. You could use a sub-domain to create a new web site, but you cannot create another sub-domain based on it. From http://www.websitepanel.net/documentation/users-guide/domains/#ManagingSub-Domains


4

You could make a very simple test to see if there is www in the URL, and if it hasn't, go to the www version via a 301 permanently moved header: if( substr($_SERVER['HTTP_HOST'],0,4)!='www.'){ header('Location: http://www.'$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'], true, 301); } Don't forget to set your canonical tags to www so bots know your ...


4

It isn't necessarily bad for SEO. You want to be careful of "sneaky redirects" (see https://support.google.com/webmasters/answer/2721217?hl=en), but this type of behavior should probably fall in acceptable territory. Honestly, from an SEO perspective, you'd be better off redirecting the broken URL to a legit page on your site via a 301 server side redirect. ...


4

You can make a 302 - temporary redirect. Example in PHP: header("Location: /product/list", true, 302); // temporal redirect The browsers requests the /home url, gets status 302, new url: /example back from the server. Your browser now says "Oh ok, I'll now open /example for now". Bots understand the redirect; the 302 makes them understand this is ...


4

Yes, the same way any request can be "dynamic". However, you would not redirect (as in your example code), you should internally rewrite using mod_rewrite. (The same as what Drupal is probably already doing.) For example, in your root .htaccess file: RewriteEngine On RewriteRule ^robots\.txt$ robots.php [L] RewriteEngine should only occur once (although ...


4

The POST request will be protected by SSL, but there are other problems to think of: When switching between HTTP and HTTPS it is easier to do an SSL-Strip attack. The session id will be sent to HTTP requests too and therefore can be sniffed easily. It is surely a good idea to switch to HTTPS for the whole site, but if that is out of question, then you ...


4

This is not secure (but better than posting to HTTP). The data will only be encrypted in cases where no man-in-the-middle attack is undergoing, but of course one of the reasons for offering HTTPS is the assumption that such MitM attacks could happen. Attackers will be able to tamper with your HTTP page. They could, for example: change the form-action URL ...


4

Just because a URL is in Google's index doesn't mean that it was submitted through webmaster tools or search console. Google includes most URLs in the index only because it finds links to them on other sites. Most of the time Google won't index a redirecting URL (including a shortened URL.) Usually Google prefers the destination. If the redirect URL ...


3

That should be: RewriteEngine on RewriteCond %{HTTP_HOST} !^www.domain.org$ [NC] RewriteRule ^(.*)$ http://www.domain.org/$1 [L,R=301] The "$1" tells mod_rewrite to add the matched text from inside the parentheses in the pattern to the rewritten URL, which is what you want.


3

While it isn't impossible to host multiple secure sites on a single IP address, thanks to SNI and SAN, the redirect you're trying to do is impossible without one of the aforementioned solutions. In order to receive a redirect from https://www.olddomain.com, the browser must have already requested that URL using SSL/TLS, and is expecting an encrypted response ...


3

We have gotten a few questions like this one. While I found one good answer for you, I thought I would take this opportunity answer the question better. There are actually two things to consider and not just one. When you want to retain the links of an old site you have essentially two tasks: one, to redirect from one site to the other properly; two, ...


3

To redirect everyone else, apart from your IP address (eg. 123.123.123.123), to the /blog subdirectory then you can use something like the following in .htaccess: RewriteEngine On RewriteCond %{REQUEST_URI} !^/blog/ RewriteCond %{REMOTE_ADDR} !=123.123.123.123 RewriteRule (.*) /blog/$1 [R=301,L] If the requested URI does not start with /blog/ and the IP ...


3

The first parameter of RedirectPermanent should be a path, not a full URL (e.g. RedirectPermanent /foo http://example.com/bar), so you won't quite be able to get what you're trying to do to work. You should be able to do it if you split the www part into a separate vhost: <VirtualHost *:80> DocumentRoot /var/www/example ServerName example.com ...


3

The HTTP status code 301 is named "Moved Permanently": The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. So the resource (i.e., your document) would stay the same, it just gets a new URI. As your front page http://example.com/ is (usually) not the same resource ...


3

If you take all the right steps, there isn't a lot to worry about. 301 all existing pages (This is the major step!) Set all you canonical tags right (This is your 2nd most important step) You will lose a little PageRank for the redirect, but we're talking minimal amount here, nothing a little time won't fix. Just read up on how to migrate sites (which ...


3

The approach of using a wildcard DNS record is probably the correct one for your use case. When you configure a wildcard DNS record, all requests to any subdomain will be resolved to the IP address of your webserver. You can then further process the request on your webserver. This approach is known as Virtual Hosting. Your webserver will decide which ...


3

If the redirects are temporal, this is fine. If the old domain should be disregarded and the new domain should be used, this is bad. As long as there's 302, the bots will periodically check the first domain and keep those in the results. If you 301 them, you tell them "forgot old url, only use new url". This last part is not happening now.


3

From a SEO perspective, using a subdomain, www, splits up visits to the site though you can combine the data into one number. Some companies want to forgo the www since it just takes up space in advertising and is useless in a sense. Having a www, just to have one, is pointless and, should I say, old fashioned. However, unless there is a technical reason or ...


3

This assumes that p, id or catid always appears at the start of the query string, and that the value of this parameter is the "file" basename in the new URL, as per your code examples. RewriteEngine On RewriteCond %{QUERY_STRING} ^(p|id|catid)=(\d+) RewriteRule ^$ /%2.php? [R=301,L] The ^$ pattern only processes requests for the document root (ie. ...


3

Redirection is the process of forwarding one URL to a different URL. There are three main kinds of redirects: 301, 302, and meta refresh. Types of Redirects 301, "Moved Permanently"—recommended for SEO 302, "Found" or "Moved Temporarily" Meta Refresh A redirect is a way to send both users and search engines to a different URL from the one they originally ...


3

RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L] Yes, that line removes a trailing slash from the URL. However, you would need a condition before that to prevent a rewrite loop if mod_dir (DirectorySlash) is active and you are requesting a filesystem directory. And that's probably the problem here. If you request /directory, where "directory" is an ...



Only top voted, non community-wiki answers of a minimum length are eligible