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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


3

Redirect original community.example.com posts to example.com You'll still need to keep the subdomain alive in order to redirect any requests (otherwise it simply won't resolve). This is just a redirect everything. In either the .htaccess file at community.example.com or the main .htaccess file at example.com (or your server config) you can do something ...


3

It is fully normal, that traffic drops after such basic change of URL structure. Google needs time to get the new structure, to re-index pages, to understand, whether the content changed and so on. I would say, the drop time is from 1 up to 5-6 weeks long. But you can speed up the re-indexing with new sitemap and new content, which is backlinked externally. ...


3

After some trys and searches I got it working using: RewriteCond %{DOCUMENT_ROOT}/$2 -f [OR] RewriteCond %{DOCUMENT_ROOT}/$2 -d RewriteRule ^([a-z]{2})/(.+)$ /$2 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L]


3

Having a single URL for each page is known as URL Canonicalization. Canonicalizing the URL for each page has been an SEO best practice for ten years or more. The search engines won't think badly of you for redirecting your short URLs to your long URLs, doing so may even improve your rankings. This StackExchange site implements redirects for ...


3

Your redirects for users without cookies are a bad idea. Googlebot never sends cookies, but Google has data centers around the world. When Googlebot crawls from a data center in France, it won't be able to get to your English website and your English website could get dropped from the Google index. Location based redirects are also problematic for real ...


3

...does that mean that all http to https "rewrites" are actually redirects? Yes. They are external redirects, not internal rewrites. But rewrite does all the changes server side and are invisible to the client. Yes, most would agree that a "rewrite" is internal to the server. And a "redirect" is external. Unfortunately, these two terms are often ...


3

This is a great idea, when handled properly. You need to to some research about domains first Verify that there is not Manual Penalty to this domain (Verify it through Google Webmaster Tool ) Check the back-links of domain if any. It might be victim of Penguin 2 & 2.1 (You can use ahref.com for example) Redirecting domains without above ...


3

If you're going to move to HTTPS, the right kind of redirect to use is a 301 redirect, which says you've moved the page permanently to a new spot. About the use of 301 redirects when moving to a new domain, Google says the following: If you can do those [301] redirects to do the granularity of page level to page level, that's a great user experience. ...


3

how many days minimum should I leave the old URLs active An infinite number of days. before I ditch them entirely Never ditch them entirely. and why? Once you create a URL, it is permanent. You are supposed to keep responding to requests for that URL for the rest of time in order to avoid breaking the Web. If you want to remove the content, ...



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