Moriah Gibbs
Moriah Gibbs

Reputation: 37

301 Redirect Error in .htaccess, shows "Bots Get Naked Version" instead of redirecting

I am looking to write 301 redirects for a site. I would like the redirect to go from http://www.ehlconsulting.com/our-services-basic-services/ to http://www.ehlconsulitng.com/services/.

My .htaccess file is as follow

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ehlconsulting.com
RewriteRule (.*) http://www.ehlconsulting.com/$1 [R=301,L]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Redirect 301 /our-services-basic-services/ http://www.ehlconsulting.com/services/

When you go to the old URL it doens't redirect. Instead it shows "Bots get the naked version"

Upvotes: 2

Views: 438

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

You probably don't want to use Redirect and want to move the actual redirect above your wordpress rules:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ehlconsulting.com
RewriteRule (.*) http://www.ehlconsulting.com/$1 [R=301,L]

RewriteRule ^our-services-basic-services/(.*)$ http://www.ehlconsulting.com/services/$1 [L,R=301]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

The "Bots get the naked version" thing doesn't have to do with your rules, it's probably WPEngine or something that's doing that by default, and you might be able to override that by using a ErrorDocument 404 in your htaccess file. The problem with using a Redirect along with wordpress' RewriteRule's is that they conflict with each other.

Upvotes: 1

Related Questions