SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cape Town, South Africa
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Push/Pull CMS for SEO

    Hey Guys,

    Gotta do this small site for a friend. It consists mainly of accommodation links...

    The site needs to be super SE-friendly, but i am not a big fan of full push cms systems, so was wondering if my thought is a viable one:

    - i want to have 1 'pull' php (gethotel.php) page that gets the info for the specific hotel depending on the parameter it gets.
    - when a hotel is added, a folder is created for that hotel, with a 1 line php page in it:
    <?echo(file_get_contents("../gethotel.php?hotel_id=1"));?>

    this works fine and my link http://url/accomodation/my_hotel/ shows the correct page etc.

    is this way of doing it viable? will it 'fool' the SE?

    Thanks in advance,
    Bjorn

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use mod_rewrite (provided that you use apache for webserver)

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cape Town, South Africa
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am a bit sceptical about mod_rewrite as i cannot find a good tutorial and info site about it...

    is my way of doing this not going to work? is mod_rewrite less work and more sufficient?

    im not flaming mod_rewrite...i just really have no clue how to go about doing this...

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BjornD
    is my way of doing this not going to work? is mod_rewrite less work and more sufficient?
    Sure it'll work, but it's a bit patchy.

    try dropping the following contents in a file named .htaccess in your webroot.
    Code:
    Options FollowSymLinks
    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME}  -d
    RewriteRule  ^.*$  -  [L]
    
    RewriteCond %{REQUEST_FILENAME}  -f
    RewriteRule  ^.*$  -  [L]
    
    RewriteRule ^.*$	index.php [L]
    It will route anything, witch would otherwise result in 404, into index.php. Inside index.php, you can then use $_SERVER['REQUEST_URI'] to determine witch script to forward to.

  5. #5
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cape Town, South Africa
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a million kyberfabrikken, i will check it out...

    unfortunately i am not sure if the host will be apache or windows

    so if its windows im basically screwed, or not?




    is my initial idea a stupid way of doing it? i wont take offense, would just like to learn the best/worst practices...

  6. #6
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BjornD, you can always use the custom error message approach. IOW, if a request is for www.yoursite.com/somehotel and the server can't find it, you just catch the 404 response with a custom php script which locates the "somehotel" and displays its page.

  7. #7
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cape Town, South Africa
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    catch the 404 response
    how would i go about doing that? will this work in a windows environment?

    still, is my intial idea a bad one?

  8. #8
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BjornD
    how would i go about doing that? will this work in a windows environment?
    Here's for Apache: http://www.onlamp.com/pub/a/onlamp/2...avidsklar.html and here for IIS: http://msdn.microsoft.com/library/en...2066105cf1.asp

    Quote Originally Posted by BjornD
    still, is my intial idea a bad one?
    No -- it's a basic Page Controller pattern. But the other solutions require less manual work.

  9. #9
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BjornD
    so if its windows im basically screwed, or not?
    you certainly are.

  10. #10
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken
    you certainly are.
    Learn your web servers before you speak.

    You are definitely not screwed. In fact, it is easier in windows. Just the 404 error page to go to a url in IIS and you are good to go.

    The only other big gotcha is PHP needs to be running as an ISAPI dll. Otherwise getting the file requested is tricky.

  11. #11
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99
    Learn your web servers before you speak.
    I meant in general.
    As BerislavLopac points out, this particular problem has a solution on IIS.

  12. #12
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cape Town, South Africa
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the replies guys...

    Certainly given me loads of options to work with...

    I can see how the other ideas would be more efficient...i think i will be going with the 404 catching technique.

    Reason i dont really want to get into which environment the host will be is cause around here clients seem to switch hosts all the time, and was wanting a system which would run stable on both apache and iis.

    BerislavLopac:
    No -- it's a basic Page Controller pattern
    sorry to carry on, but what exactly does that mean...kinda new to patterns (heard about them 2 weeks ago only). Have any cool links to nice pattens sites?

    thanks again!

  13. #13
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  14. #14
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    @kyberfabrikken: ooh, we are cool because we use open source. Micro$oft sux. You are l337 h@x0r.

    @BjornD: Actually, this is your original idea, just setup in a slightly more efficent manner. Rather than having to setup a large number of folders and index.php files you are centralizing the control and dispatching.

    One protip: make sure your "404" page sends a http 200 header. Elsewise IE will crap itself.

  15. #15
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cape Town, South Africa
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for all the help guys...

    Just a bit confused, do i not even set up the folders? i just call a non-existent folder which then results in a 404 error returning the location i tried to call to the '404 handler'?
    Then with this location i redirect to a specific page?

    Will this still be SE friendly? Will a spider still pick the content up as being at www.abc.com/folder/, or will it find www.abc.com/file.php?id=folder ?

    Sorry for all the questions, im just a bit (maybe more than a bit) confused here...

    ps. how do i send a http 200 header from a 404 page?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •