• Hello,

    I am converting a site that was originally done in .asp to WordPress. This old site has a few subdirectories with many files in them and all have good backlinks on top of files in the main directory.

    Example:

    /file1.asp
    /subdirectorya/afile.asp
    /subdirectoryb/bfile.asp

    I can create posts with the same name, such as file1.asp using /%postname%/.asp for a permalink, but how do I make a post (or page) so that I also have the subdirectory included?

    Say that my original page’s filename is product1.asp inside the directory subdirectorya.
    When I edit the permalink in the post to be /subdirectorya/product1, I get /subdirectyaproduct1.asp for the filename which is not the same as
    /subdirectorya/product1.asp which is what I want.

    I’m trying to avoid a ton of 301 redirects and use the existing format that I have – this way, everything looks the same but I have the WordPress backend to manage everything.

    Is there a solution or does using WordPress mean that existing subdirectories have to be eliminated (301’d)?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can’t change the directory of a post URL by editing the permalink on the post page, as you have discovered.

    On one site that included thousands of pages of what were previously individual HTML pages, I added the URL of the old HTML page as a custom field associated with the new WP post. I set up WP as the domain’s 404 handler and wrote code in WP that when a URL is unknown within WP to search for the existence of a custom field with that URL. If it exists, retrieve the associated WP post ID and slug and do a header:location 301 redirect to the new URL of the old page.

    Because you have multiple top level subdirectories, the old url’s you’d need to store in the custom field would have to be /subdirectorya/afile.asp. Your code would parse the requested URI, extract the old URL, and do a database query to see if that old URL is in a custom field. If not, return 404. If found, do 301 redirect.

    The end result is I am redirecting thousands of pages with a few lines of PHP code.

    This way, you do not need to maintain the directory structure of /subdirectorya/afile.asp within WordPress. If you want to know which posts used to be in /subdirectorya/ assign them to a category for that purpose.

    It does mean you can’t have two posts anywhere in the system that have identical post slugs, so if you had mypost.asp in more than one subfolder, one has to be renamed within WordPress.

    Info on working with custom fields is here
    http://codex.wordpress.org/Custom_Fields

    Thread Starter enav

    (@enav)

    Thanks Stvwlf!

    So far, I have discovered these options…

    Install wordpress in each directory all installations using the same DB

    or

    Use WP-Hive plugin.

    The site is very large and I have no idea what the hive plug is doing behind the scenes and am reluctant to base my entire site around a plugin, so I am now leaning toward multiple installations. I don’t have that many directories and think I’ll be okay.

    I could do a 301 easy enough in the htaccess for each sub-directory, however, I want to keep the structure. Who knows what the Google machine will do with so many redirects…

    FYI: Samboll posted links to this:
    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    Then when you are ready with the other, simply move your index – read about it here:
    http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Within_Your_Site

    Right direction? Am I missing something?

    Thanks!

    why are you thinking of multiple installations?

    Thread Starter enav

    (@enav)

    Just noticed this response / question…

    That is all I am aware of right now – multiple installs. One for the main site, then one for each subdirectory. Once configured, I think I can point to the main files but reference a different table in the same database. This way, I only need to update wordpress files once when updates occur.

    However, I think I’m going to have to modify the theme (give each theme a slightly different name) and then modify all but the main theme to show only the files that would have been in that directory (original directory) and hard code the main menu.

    I’m going to try WordPress MU – but I think I’ll have issues with plugin compatibility, etc.

    If you know of some other way of doing this – please, share 🙂

    Thanks!

    why can’t you put them all into a single site? are they naturally, essentially different sites anyway due to diversity of content?

    why do you have to maintain the old URL structure of
    /subdirectorya/afile.asp
    /subdirectoryb/bfile.asp
    ??

    as long as the old url’s still bring up the desired content (301 redirect) why can’t they all have url’s like
    domain.com/afile/ and domain.com/bfile
    even though they were originally in different folders?

    if the content is very different, sure, use multiple installations. But if the content is similar and related, and the same theme is going to be used on both, why have multiple installations?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Conversion, permalinks and subdirectories – how?’ is closed to new replies.