redirect /oldStaticDir/index.html to /newWPDirectory
-
So I am almost finished moving a static site on to wordpress.
The old site structure was in the following format –
https://domain.com/sub1/index.html
https://domain.com/sub1/page1.html
https://domain.com/sub1/page2.html
https://domain.com/sub1/page3.htmlhttps://domain.com/sub2/index.html
https://domain.com/sub2/page1.html
https://domain.com/sub2/page2.htmlhttps://domain.com/sub3/index.html
https://domain.com/sub3/page1.htmlWhat I have managed to accomplish thus far.
I have all the images loaded in the database and doing the right thing in both wp-admin visual editor and on the pages.
Same for my JS and CSS files.
Created a theme for this site from scratch.The way I handled my sub-directory index pages was to create a wp-category for each sub-directory. So what I have in wordpress is
categories for sub1, sub2, and sub3
I used custom permalink structure /%category%/%postname%.html
and created posts for each page and assigned the category.
For example I have page1 in category sub1. So the url becomes just as you would expect.The solution I am working on involves creating category templates to handle the index.html for that category and redirecting canonical links to the category url.
For example, I have category-sub1.php.
in this file, I am running a loop that only shows content of a post that I have named sub1-index, and I am redirecting that page sub1-index.html to sub1 in .htaccess.
Here is the problem. When I request
https://domain.com/sub1/index.html I am redirected to
https://domain.com/sub1
and I get the content of the post sub1-index
THIS IS GREAT!BUT When I request
http:/domain.com/sub2/index.html I am redirected to
https://domain.com/sub1WHY!?!?!?!?!?!?!?!
- The topic ‘redirect /oldStaticDir/index.html to /newWPDirectory’ is closed to new replies.