Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

.htaccess file, redirects, and making dev site live WordPress

  • SOLVED

I am currently moving my site, Web100.com, from Drupal to WordPress, and I have a large number of redirects (about 1,200). The current "temp"/dev site is at http://174.122.37.162/~web100co/.

I'm testing the redirects, placing them in the .htaccess file, and for some reason redirects that have the word "category" in them don't work.

So redirects like this (and there are hundreds of them) work fine:
Redirect 301 /books-100/biography-and-memoir/farm-city http://174.122.37.162/~web100co/2010/06/10/books-100/biography-and-memoir-books/farm-city-2/

But a redirect like this one generates an Error 404 message:
Redirect 301 /books-100 http://174.122.37.162/~web100co/category/books-100/

The difference seems to be that all of those with the "category" in the target URL don't work.

Does anyone have an idea of why? Here's a link to a copy of what's in the .htaccess file:
https://www.sugarsync.com/pf/D906287_300553_641579

Also: As I noted, I have been building my website using the temporary
URL (http://174.122.37.162/~web100co/) provided my host, Site5.

In order to make this site live, I was wondering whether I need to do anything other than switch the nameservers to point to Site5 (the site was previously hosted elsewhere) AND change the http://174.122.37.162/~web100co/ to http://web100.com in the WordPress General settings.

It's really the latter part (the switch in the General Settings) that I'm wondering about. Is that all there is to making the site live, or is it more complicated than that?

Answers (6)

2011-06-22

Hardeep Singh answers:

Hello,

I saw the .htaccess and here are my observations:

- It has grown too many lines (with duplicate rules)
- There is possibility that rules leading to 'circular' redirects. (I faced similar problem leading to 404)

Suggestion:
- Clean the .htaccess and limit to needed rules
- Clean duplicate rules. Even 'RewriteBase /~web100co/' is defined twice.
- Please check the 'RewriteBase /~web100co/', Are both on same server or different. If they are same, then rules need to be re-defined as target directory is same.

- Hardeep

2011-06-22

Maor Barazany answers:

About the .htaccess issue - it is too many lines to have ~1200 lines of redirections in the files, that they are being run line by line for each server request. It is better for you to use a [[LINK href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#mapfunc"]]RewriteMap[[/LINK]], but you can have it only if you use a VPS hosting and not on shared, since the map file should be pointed from the server configuraiton file or from the virtual host configuration file, then in the .htaccess you will have less lines.

2011-06-22

Luke America answers:

This may be connected to the major WordPress 3.1+ permalinks bug. It manifests itself on 1000's of WP installations because the developers rewrote the canonical redirects. It occurs in uri's which have 'catagory' or 'tag' in the path ... affecting menu links, drop down menus, rss category/tag feeds, and category/tag pagination.

I've written a plugin to fix the bug. You can download it and read several techniques to repair the issue at the following link:

[[LINK href="http://wpcodesnippets.info/blog/wcs-custom-permalinks-hotfix.html"]]WCS Custom Permalinks Hotfix[[/LINK]]

2011-06-22

Utkarsh Kukreti answers:

Could you post a link to the complete .htaccess file?


Allan Hoffman comments:

Yes, I added it to the question. Here's what's in .htaccess:
https://www.sugarsync.com/pf/D906287_300553_641579

2011-06-22

Vidyut Kale answers:

About the changing http://174.122.37.162/~web100co/ to http://web100.com - you'll have to do that in this .htaccess as well, and any other hardcoded links that may be on your site.

About your category redirect mystery... what happens when the redirect fails? 404? or something else?


Allan Hoffman comments:

Yes, I get a 404 error when the redirect fails.


Vidyut Kale comments:

In your permalinks settings, change your category base to something else and see if the redirect starts working or not (if it works, you'll obviously get a 404 for the new url after changing base). Let's see if its with the word "category", or with "cateogry" being base url for categories.


Vidyut Kale comments:

Are you using any redirection plugin as well? If so, see what happens when you disable it.


Allan Hoffman comments:

Changing category to something else has no effect.


Vidyut Kale comments:

And if you change the redirect to your new base url? Does that work?

2011-06-22

John Cotton answers:

<blockquote>The difference seems to be that all of those with the "category" in the target URL don't work.</blockquote>

'category' is the default base for category archives.

Go to Dashboard > Settings > Permalinks and set something else.


Allan Hoffman comments:

Um, is there a reason why changing the default base would affect this?


Allan Hoffman comments:

Changing category to something else has no effect.