SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Orange County
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 Apache problems - Going from dev to prod server

    I just moved my development site from my home windows XP system to the production *nix server and a couple items aren't working right.


    #1: My seo friend urls don't work
    www.website.com/articles/item/1.html = www.website.com/articles.php?item=1

    For some reason when Apache is backtracking through the url looking for a directory or script to run it doesn't know what articles is. If I have it written as www.website.com/articles.php/item/1 it works properly. But the url doesn't look as clean and isn't as seo friendly as it was created to be.

    It works perfectly correct in the development server and its either an apache http config setting problem or a Windows to *nix problem.


    #2: PHP Driven Static Page creator not working
    I have built a simple script that takes a create/edit record in the database and creates a html page out if it. It does not want to save the page on the server. It definately has to do with the file/folder permissions.

    Since the html pages created are to be saved in the public_html folder, is there any way to configuration Apache/PHP to create the files there without having to set the permissions on the public_html folder to 777, which I am assuming is REALLY bad? Something like having Apache/PHP run as a user instead of world/global?

    Please any information will be greatly appreciated.

    Thanks in advance,

    Sean

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    AX,

    Quote Originally Posted by AXM
    I just moved my development site from my home windows XP system to the production *nix server and a couple items aren't working right.


    #1: My seo friend urls don't work
    www.website.com/articles/item/1.html = www.website.com/articles.php?item=1

    For some reason when Apache is backtracking through the url looking for a directory or script to run it doesn't know what articles is. If I have it written as www.website.com/articles.php/item/1 it works properly. But the url doesn't look as clean and isn't as seo friendly as it was created to be.

    It works perfectly correct in the development server and its either an apache http config setting problem or a Windows to *nix problem.
    If Apache's mod_rewrite is working (as it appears to be), then this should work for you (.htaccess in your website's root directory):

    Code:
    RewriteEngine On
    RewriteRule ^articles/item/([0-9]+)\.html$ articles.php?item=$1
    ... although, personally, I'd drop the item/ and .html from your URLs as they're superflous to SEO, i.e., articles/12345 would get the job done just as well as articles/item/12345.html -- even better!

    Quote Originally Posted by AXM
    #2: PHP Driven Static Page creator not working
    I have built a simple script that takes a create/edit record in the database and creates a html page out if it. It does not want to save the page on the server. It definately has to do with the file/folder permissions.

    Since the html pages created are to be saved in the public_html folder, is there any way to configuration Apache/PHP to create the files there without having to set the permissions on the public_html folder to 777, which I am assuming is REALLY bad? Something like having Apache/PHP run as a user instead of world/global?
    I think you've hit the nail on the head with permissions. It's okay to have the 766 or 777 as you MUST allow PHP to write to your directory whereas others will still need your FTP username and password to get to that point! Since you don't post that info on your site, there shouldn't be a problem.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Orange County
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks David. I think I was just intimidated from hear others about using excessive 777 permissions.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    AX,

    No problem! Using them excessively might be a danger but you've GOT to allow PHP to write and that's the only way it can be done.

    For critical files (like database login, etc.), LOCK DOWN those directories so NOONE can view them (except you, of course) 'cause PHP can get into them with no problem via include() or include_once().

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Orange County
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it. Everything that shouldn't be modified has permissions changed and moved outside of the web root. Thanks again.


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
  •