Tag Info

Hot answers tagged

6

The way that you will do the 301 redirect does not play any role for the Google. Actually it does not see your configuration file. What it is important is to send the 301 headers with the new location on each old url and not just the home page. For example if you have 10 pages on the old website, make sure that these all pages are redirected to the new 10 ...


5

Just redirect by 301 HTTP status all your old URLs to the new ones. If you only change file extension, you can do it easily with an .htaccess file (if you use Apache as a web server). Put these lines in your .htaccess file: RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php Of course, change www.example.com by your domain name. By using 301 ...


4

You're almost there. Drop the very first RewriteCond (as it's not required and won't match ever) and add a trailing / to your last RewriteRule since you're redirecting with them. RewriteEngine On RewriteCond %{HTTP:Accept-Language} ^en [NC] RewriteRule ^$ http://mysite.com/en/ [L,R=301] RewriteCond %{HTTP:Accept-Language} ^de [NC] RewriteRule ^$ ...


4

You can use one of these solutions: Keep the Current .html extension unchanged for just frontend purpose and use Apache .htaccess file to proxify your requests so that. Add this to your .htaccess file to work: RewriteEngine on RewriteRule ^(.*).html $1.php OR Why not just have the HTML pages parsed as PHP? That way you can get the best of ...


3

You need to enable the rewrite engine in your .htaccess file if you have not done already... RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] Note that I've removed the extra .com on the RewriteCond line that you have in your question - I'm assuming this was a typo? Also, FollowSymLinks ...


3

This should work for files of any extension: RewriteEngine on RewriteCond %{QUERY_STRING} ^/(.*\..*)$ RewriteRule ^index\.php$ http://www.newsite.com/%1? [L,R=301] Or to redirect the entire path and file request: RewriteEngine on RewriteCond %{QUERY_STRING} ^/(.*)(\..*)$ RewriteRule ^index\.php$ http://www.newsite.com/%1%2? [L,R=301]


3

In the SSL config, move the first rule in the Wordpress Magicks up above your rule handling redirection. # Internal redirects, stop doing things! RewriteRule ^index\.php$ - [L] # Redirect all non /order/ page URLs to HTTP RewriteCond %{HTTPS} =on RewriteCond %{REQUEST_URI} !^/order/$ RewriteRule (.*) ...


3

The pseudo-code translation of your .htaccess file would be something along these lines: Line 1: In case we weren't previously planning to do anything special with URLs, we are now (RewriteEngine is an optional processing module and we're making sure its enabled). Line 2: When we're talking about rewrite URLs, from here on append the path /, which in your ...


2

Rewrite rule in .htaccess: RewriteRule ^test(/.*)?$ test.php?path=$1 Contents of test.php: <?php if($_GET['path']){ echo ($_GET['path']); } ?> Then when I hit /test/foo/bar on my server, the PHP page prints out /foo/bar.


2

So just to expand on my comment, the request path appears to be missing the initial /, so it should be: RewriteCond %{REQUEST_URI} !^/order/$ the clue was this line from your rewrite log: RewriteCond: input='/order/' pattern='!^order' => matched as you want that not to match for your rules to work. It's quite common for mod_rewrite rules to include ...


2

Google won't generally outright penalize a site for this. Most sites accept any URL parameters which don't change the page, but do change the URL: http://example.com/page.html http://example.com/page.html?foo=bar Usually when Google finds duplicate pages within your site, it just chooses one to index and ignores the rest. The disadvantage to your setup ...


2

Your expression is incorrect. Since / is missing from the first part of the expression, it will not match anything which is in a sub-directory. Since the last expression requires there to be numbers at the end, it would work with URL that end in letters as per your examples. You must generalize your expression, something like this: RewriteRule ...


2

To isolate the problem, first try it without the redirect. If it still doesn't work, then make sure that the httpd user (e.g. nobody) has read access to the GeoIP database files, as covered in the Troubleshooting section here. Also make sure that each line in your .htaccess file or main server config ends in a newline, and remove the spacing before ...


2

Does purposely and permanently having invalid URLs on your site that get 301'ed to the correct ones have any effect on SEO? I could make it just show the correct URL to begin with, but this is a significant amount of work due to how I am handling the translations, so I would prefer just to 301 them. Arguably, yes. According to Google, a 301 ...


2

RewriteCond %{HTTP_HOST} ^tech\.doig\.com\.au$ [NC] RewriteRule . - [S=120] You appear to be Skipping all of the relevant redirects when the HOST matches tech.doig.com.au, which would seem to be the opposite of what you are trying to achieve. As it stands, your redirect would only occur when the domain is not tech.doig.com.au. It looks like your ...


2

If you are changing an existing URL structure then you will need to redirect the old (ugly) URLs to the new (pretty) URLs, rather than reject them with a 403 response. If it's a brand new site then you could reject them with a 404 (R=404) - preferable to a 403 I think in this instance. Something like the following (placed before your existing rewrites): ...


2

You have RewriteEngine On missing RewriteCond are only applicable to next immediate RewriteRule Try this code: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^explore/(.*)$ index.php?page=explore&type=$1 [L] RewriteCond %{REQUEST_FILENAME} !-l ...


2

As mentioned in comments above, you'll need a RewriteCond directive in order to prevent an internal rewrite loop. Whilst the L flag terminates the current rule set, the entire process is started again with the rewritten URL, so we need a get-out clause. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{QUERY_STRING} !^fid= RewriteRule ...


2

Yes that's correct and would 301 redirect everything on oldsite.org to the same path on http://newsite.com. Plenty of similar questions on the StackExchange network such as this one.


2

Either all Options must start with + or -, or no Option may. Ah yes! This behaviour has changed with the move to Apache 2.4 - it has always been invalid - but now "will be rejected during server startup by the syntax check with an abort." Reference: Apache Docs You need to specify a + before the Indexes option: Options +Indexes +FollowSymLinks ...


1

You won't be able to have both your Swedish content and your English content crawled and indexed by Googlebot like that. You don't say how your are determining language. Googlebot doesn't send accept-language headers, so your redirects may not even work for Googlebot. If you are redirecting based on geographic location of the IP address, Googlebot will ...


1

Neither of your attempts to get the syntax for your "Redirect 301" rules is correct. The format should be: Redirect 301 /relative-uri http://fully.qualified/url So: Redirect 301 /test.html‎ http://www.example.co.za/page/pop/test Redirect 301 /about.html‎ http://www.example.co.za/about As nathangiesbrecht says, your rewrite rule may also be ...


1

According to MaxMind for GeoIP: The latitude and longitude are near the center of the most granular location value returned: postal code, city, region, or country Therefore, latitude and longitude won't be any more precise than city or postal code, and could correspond to the region or country if those are not available. Since it appears that your ...


1

I think you have the correct idea, but the directory prefix (/) is probably the main thing that is causing problems. Try the following... RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^site\.com$ [NC] RewriteRule ^version$ /version.php [L] RewriteCond %{HTTP_HOST} ^site\.com$ [NC] RewriteCond %{REQUEST_URI} !^/version RewriteRule (.*) ...


1

From the phpBB documentation if you move the directory in which it is installed you may need to change the SCRIPT PATH as defined in the configuration file. It looks like you will only need to do this if you also have the FORCE SERVER URL SETTINGS option set, otherwise phpBB adapts to whatever directory you have it in. Your redirect code looks correct. As ...


1

You would not usually use rewrite rules to set up different host names on a local server. Instead you would edit your Apache configuration and set up new virtual hosts. <VirtualHost *:80> DocumentRoot /var/www/htdocs/dev_site_com ServerName dev.site.localhost </VirtualHost> <VirtualHost *:80> DocumentRoot ...


1

This should do the trick: RewriteRule ^.+\/images/$ images/$1 [L] In regex, the .+ is a wildcard matching at least one character, so it will match www.host.com/**a**/images and www.host.com/**a/b**/images but not www.host.com/images. When working with regular expressions for pattern matching, I have always found this page helpful: ...


1

Yes, declare index.html as canonical url at Meta tag in HEAD section (mentioned below): <link rel="canonical" href='http://stacklint.aboutscript.com/index.html'/> or <link rel="canonical" href='http://stacklint.aboutscript.com/'/>


1

If your .htaccess is not being read by the server, then that's the problem you need to fix first. Enabling .htaccess files is done using the AllowOverride directive, which tells Apache to look for that file in the specified folder for additional configuration info. If you're using the default vhost (which will be somewhere like ...



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