Page 1 of 1

[SOLVED] Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 21:39
by kolja
Hi all,

first of all, haven't had a look for phpwcms since leaving the country (directly after 1.3.3 was published). Just checked 1.4.X DEV - some beautiful little changes. Great guys! Thanks to all people somehow involved.

My Question - couldn't find anything searching the board:

I want to move an old plain-html-project (500+ pages) to phpwcms. My probably largest problem is not loosing all the hundreds of external links pointing to my pages AND not loosing all the existing google-links. As you probably can imagine, i don't want to have the page killed by loosing all links. On the other hand administrating 500+ pages is a pain.

So far the old webpage is kind of structured in the following way
(UPPERCASE -> directory, lowercase -> file):

ROOT
+--- index.htm
+--- TOWNS
...+--- overview.htm
...+--- BERLIN
......+--- index.htm
...+--- MUNICH
......+--- index.htm
+--- SIGHTS
...+--- overview.htm
...

My main-objective is to get phpwcms involved and somehow still keep the links to the old pages alive. Do you have any suggestions/experiences regarding that topic? Would be absolutely great as otherwise using my favourite cms wouldn't make sense.

Thanks in advance.

Re: Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 22:43
by update
You could (easily ;) ) do something like the following in your .htaccess:

RedirectMatch 301 ^/TOWNS/overview.htm(.*)$ /index.php?aid=497
RedirectMatch 301 ^/BERLIN/(.*)$ /index.php?aid=47
RedirectMatch 301 ^/BERLIN/(.*)$ /index.php?aid=47

or just plain to the root index.php
RedirectMatch 301 ^/BERLIN/(.*)$ /

Check it out!
It will become a long list, but the permanently redirected addresses will be indexed soon... (hopefully) ;)
For me it did the work...

Re: Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 23:00
by kolja
claus wrote: Check it out!
It will become a long list, but the permanently redirected addresses will be indexed soon... (hopefully) ;)
Sounds like a first very good idea. It tells you that the page has permanently moved AND directly redirects you? Would be a bloody good solution. And claus, :wink: one long list is thousand times better than changing 500+ files each time something has to be changed. Would be a dream!

Do you only have to place ONE htaccess into root-directory or into each directory of the full old structure?

But one more question regarding the htaccess - perhaps you know: The htaccess delivered with phpwcms never properly worked for me (rewriting index.php?test -> test.phtml). My ISP told me that mod_rewrite is activated and working properly. Any ideas/links to forumpage?

Re: Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 23:12
by Jensensen
@claus: Any example how the URL will look?

I'm still waiting for issue 132 http://code.google.com/p/phpwcms/issues/detail?id=132

Re: Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 23:21
by kolja
Jensensen wrote:@claus: Any example how the URL will look?
claus wrote: RedirectMatch 301 ^/TOWNS/overview.htm(.*)$ /index.php?aid=497
-> http://www.domain.tld/index.php?aid=497
claus wrote: RedirectMatch 301 ^/BERLIN/(.*)$ /
-> http://www.domain.tld/index.php

Re: Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 23:31
by update
No no, you have a standard .htaccess in your phpwcms- root. There you'll write down your list. As far as I'm understanding your concern you are going to switch over the content of your "old" site into the cms, right? If done, the same domain will be routed to the newly set up cms and bang!

(But do some testing before with two or three test articles on a test domain - perhaps we'll have to tweak some more ;) )

@Jens ;) Perhaps this is even rewriting the address into some nicely formatted hamburg.phtml with one stroke? Who knows :lol:

Re: Rewrite - Simulating Directory Structure

Posted: Sun 18. Jan 2009, 23:55
by kolja
claus wrote:Perhaps this is even rewriting the address into some nicely formatted hamburg.phtml with one stroke? Who knows :lol:
Definitely new names will contain main-keywords! Haven't had position one for a long time without a reason :mrgreen: .

I'll have a completely new directory-structure with a filled and tested phpwcms and a fully functional htaccess. Once everything works and is double-checked, i'll switch the domain to the new directory and - with your words: Bang. :mrgreen:

Thanks, claus.