[SOLVED] Rewrite - Simulating Directory Structure

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
kolja
Posts: 43
Joined: Sun 19. Mar 2006, 13:40

[SOLVED] Rewrite - Simulating Directory Structure

Post 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.
Last edited by kolja on Tue 20. Jan 2009, 11:20, edited 2 times in total.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Rewrite - Simulating Directory Structure

Post 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...
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
kolja
Posts: 43
Joined: Sun 19. Mar 2006, 13:40

Re: Rewrite - Simulating Directory Structure

Post 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?
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: Rewrite - Simulating Directory Structure

Post 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
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
kolja
Posts: 43
Joined: Sun 19. Mar 2006, 13:40

Re: Rewrite - Simulating Directory Structure

Post 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
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Rewrite - Simulating Directory Structure

Post 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:
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
kolja
Posts: 43
Joined: Sun 19. Mar 2006, 13:40

Re: Rewrite - Simulating Directory Structure

Post 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.
Post Reply