# How do I change the permalink structure without getting 404s?

after updating the permalinks from the default /?p=N to another setting (e.g. /%year%/%monthnum%/%postname%/) all my old links are broken and also the archive, catgories etc. side bars get 404 errors.

How can I avoid this (or redirect) without changing the .htaccess (which I can't access using my hosting package)?

Any suggestions or plugins that work with my current version (WP 3.1) are welcome!

Thorsten

-
Thanks for all the answers, they helped me to look deeper into the issue .. and as people have indicated, I do have an .htaccess file that I can change. I have accepred John's answer and posted a new question (#12444) that is hopefully more helpful in pinning down the issue. –  IronGoofy Mar 18 '11 at 23:16

If you can't modify .htaccess then chances are WordPress can't either. Save your permalinks again and check if it tells you it couldn't save your htaccess file. That's your problem if so.

Bigger question: why are you using a host that won't let you modify .htaccess? That's like renting an apartment from a landlord that won't let you use the bathroom. You're paying them for space on that server and you should be allowed to use it in any legal way you see fit. My advice is that you change hosting providers.

-
1. Changing from the default permalinks (?p=1) to another structure is always safe. WordPress always recognizes the default permalinks and will redirect to the canonical links.

2. If it's not doing that, then likely the .htaccess is broken or not being read. Make sure that the rules are in the .htaccess file, and/or contact your host.

Some cases this can be weird when you first create the .htaccess file. For example, on GoDaddy hosting, the first time you create an .htaccess, the servers don't actually use it for a couple hours. So when you enable pretty permalinks for the first time, the whole site seems to break. A couple hours later, it fixes itself. This is because of the way their hosting system works, it has to recognize the existence of .htaccess files and enable them on a per-site basis. Changes take effect instantly, it's only that initial setup that takes time.

Your host may have something similar, so even if the .htaccess is there, it may not have taken effect yet. Talk to the host about it.

If you cannot modify the .htaccess at all, then Pretty Permalinks simply will not work. Switch to a sane host.

-

Hi @IronGoofy:

You can implement redirects with the 'template_redirect' hook as my answer to the following question illustrates:

Note that I don't use .htaccess for this because I find .htaccess modifications fragile and hard to debug. In my opinion it's much better to do these things in .PHP unless your server is constantly getting hit by thousands of requests for these old URLs per hour and then the efficiency of .htaccess might be worth the extra effort (but if you have such traffic your site probably would demand more than a lower end web hosting package too.)

-

Try the Redirection plugin: http://urbangiraffe.com/plugins/redirection/

Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.

-

install Dean's Permalinks Migration plugin or Taxonomic SEO Permalink (not sure wich one did the job) :p chance your permalink, you get a message that says update your htacces file.

go into your site with an ftp client (file zilla), find the .htaccess file, copy it to a back up folder on your desktop.

now edit the htacces file, replace the code with this: RewriteEngine On RewriteBase / RewriteRule ^index.php\$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

problem should be fixed

-

@IronGoofy, Check this out. it's a tutorial about migrating permalinks properly. I didn't tried it but it could be useful.

-