Hot answers tagged

10

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 ...


6

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

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 ...


5

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 ...


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 ...


5

What seems to be happening, is your rule is being matched and then apache is sending a 301 redirect response telling the browser to generate a new request for /web-browser-benchmarks-firefox-chrome/ Chrome is generating this request - as instructed, but when your webserver see's this new request - your rule is matching that request too - again telling ...


5

Well aren't you friendly... "Hey Google, I'm having a DOS, but im making it your problem, thanks" First: There is no difference for you between serving an 301 or an 404 error page. Your server will have to do the same amount of work. The difference here is that you, with your 301->google solution, now ALSO make it Google's problem, effectively doubling ...


5

I would very much like to use wildcard redirects where possible (like in the directory structure that contains 2,000 MP3 files). If your server software is apache, then you can use the rewrite module to redirect some URLs to others using wildcard character sequences in the regex. For example, to redirect http://example.com/apple1, ...


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

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

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 ...


4

It's called adaptive web development. You need to detect the user-agent and serve different markup based on the device. In PHP, you can use $_SERVER['HTTP_USER_AGENT']. You'll want to include this code in order to let Google know what you're up to: <?php Header('Vary: User-Agent'); ?> Here's some more info: ...


4

# Use PHP5.4 as default # Changed PHP handler from application/x-httpd-php54 to application/x-httpd-phpbeta on Thu Dec 17 16:50:26 MST 2015. AddHandler application/x-httpd-phpbeta .php # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Insert redirect based rewrites here. # Example: RewriteRule ^redirectme$ ...


4

The domain authority on expired domains comes mostly from the inbound links to their deep pages. If you have similar enough content that your domain can satisfy the users that click on those links then you might get some SEO benefit from the domain redirect. To get it, you would have to put appropriate redirects in place. For example if you find a link ...


4

You should probably implement a rel="canonical" element in the head section of the old content that points to the new content. For example: <link rel="canonical" href="http://example.com/new-page"> This informs the search engines that the /new-page is preferred and should be returned in the search results instead. Note that this is advisory, so if ...


4

Absolutely. Your .htaccess file is located in the root directory of the website and can be accessed via FTP.


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 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

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 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

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

For worldwide compatibility, the answer is no. The reason is because not everyone can read messages very quickly, and depending on the contents of your error page, it might take someone with poor eyesight at least a few good minutes to read everything on it. Also, there's a chance that the person using the site has a poor understanding of the language the ...


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. ...



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