Ok I have a WP site using the permalink structure of /%category%/%postname%/
I have built it in the way of page templates, using category queries inside, i.e.
page-help.php
<?php $my_query = new WP_Query('category_name=help');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<!--content-->
<?php endwhile; wp_reset_query(); ?>
page-about.php
<?php $my_query = new WP_Query('category_name=about');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<!--content-->
<?php endwhile; wp_reset_query(); ?>
Pretty simple. The problem I have is, I need an archive by year for the news section. I did this by just making the archive.php have the same layout as page-news.php and just query the posts in the news category. *-this is fine in my case because news is, and will only ever be the content to be archived.
My news category (latest-news) is a child of the about category (about), so when I go to the news section, the url is:
www.example.com/about/latest-news/
On the news page is use the following code to list the archives;
<!-- Gets archive for news-->
<?php $my_query = new WP_Query('category_name=news_article');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php wp_get_archives('type=yearly'); ?>
<!--Ends archive for news-->
<?php endwhile; wp_reset_query(); ?>
The links it generates naturally lead me to
www.example.com/2000
www.example.com/2001
etc. I want the rewrite to change them to
www.example.com/about/latest-news/2000
www.example.com/about/latest-news/2001
I have modified the .htaccess in the WP route to this:
# 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]
RewriteRule /([0-9]+/?)$ /about/latest-news/$1 [NC,L] #Added this line
</IfModule>
But I am having no luck, the url remains as
www.example.com/2000
I have the issue of not knowing wether my re-write is wrong, wether I should be putting this line of re-write in a different htaccess elsewhere, or if WordPress is overwriting it.
Any help would be really appreciated.