Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a wordpress site that is extremely large and pushing Wordpress to its limits. It uses a number of pages/categories and a lot of .htaccess rules to organise the various sections of the site, (it's for a large magazine).

One particular issue is really stumping me. I have the following rules in .htaccess ...

RewriteRule ^(cat|tag)/([^\/]+)(/?)$ index.php?page_id=3&s1=$2 [L,QSA]
RewriteRule ^xyz/([^\/]+)(/?)$ index.php?page_id=6&s1=$1 [L,QSA]

Now, if the argument supplied to the cat/tag page has no trailing slash, it always works. If the argument has a trailing slash, and the tag in question matches the entries in a non-Wordpress table that work with the 'xyz' page, Wordpress loads that page instead, even if the tag is present.

I have tested that the rules always work, and they do. Wordpress is always getting the correct $_GET['page'] of 3 and the tag slug as $_GET['s1'], and yet decides to show a different page altogether if the above is true.

Everything is done within .htaccess, permalinks in wordpress are turned off completely. How can I stop WP form deciding against the page_id it has been told to use.

share|improve this question
add comment

1 Answer

Hi @beseku:

WordPress' URL routing is really difficult to work with. I'm looking forward to the day it's replaced with something more rational (and I hope that I get to be the one to write the code to replace it, but I digress...)

However I think your first problem is trying to do everything in .htaccess. I've probably got more experience with URL design and URL rewriting than anyone else I know and I really wouldn't try to fight WordPress with .htaccess; you are most likely only going to get the kind of results that are currently driving you crazy. Instead I'd try to manage URL routing from within WordPress and using hooks for when you need to override something WordPress is doing really screwy.

However, for me to fully understand what you are trying to accomplish and prescribe a proper solution I'd want to see a full map of URLs you have on your site and those that you want.

Finally I've linked some related Q&As below. They are not directly answering your question but they might give you some insight and the last one is about scaling WordPress for high traffic.

share|improve this answer
    
+1 for the awesome answer + links :) –  David Jul 10 '12 at 13:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.