Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
  • PHP or ASP (In: General Search Engine Optimization)
  • what is best php or html? (In: General Search Engine Optimization)
  • Featured Web Site Template

    Hundreds More at Free Site Templates.com!

    Web Site Partners
    Sponsored Links
    Jet City Software
     
    Whos Here ?
    Reflects user activity within the last 5 minutes
    Moderator(s): Prowler, jcokos
    Member Message

    omoutop
    Joined: Feb 16, 2004
    # Posts: 22

    View the profile for omoutop Send omoutop a private message

    Posted: 2004-Jul-28 15:46
    Edit Message Delete Message Reply to this message

    Hi,

    I have great results in Google with .htm pages. For easier work I decided to change my .htm pages to .php pages. For exemple: ../spain-hotels.htm to ../spain-hotels.php (on the same domain)
    I was told:"use the same mod_rewrite to make your actual php pages look like .htm for the search engines and others.
    You may use something like this:
    RewriteEngine on
    RewriteBase /
    RewriteRule (.*).htm$ /$1.php"

    Can anyone can explain me what it theoricaly means?

    Thank you





    bhartzer
    Staff
    Joined: Jun 08, 2000
    # Posts: 7042

    View the profile for bhartzer Send bhartzer a private message

    Posted: 2004-Jul-28 16:55
    Edit Message Delete Message Reply to this message

    In other words, your urls won't change. You will still have the www.domain.com/product.htm page but it will act just like a PHP page, so you can put all the php code into that page and it will work just fine.



    StupidScript2
    Joined: Mar 23, 2004
    # Posts: 183

    View the profile for StupidScript2 Send StupidScript2 a private message

    Posted: 2004-Sep-01 20:30
    Edit Message Delete Message Reply to this message

    Right (of course), bhartzer.

    Specifically:

    RewriteEngine on
    Turns on the Apache Rewrite Engine (if it is compiled in during installation)

    RewriteBase /
    Sets the base address for applying the rewrite rules to the web document root directory (all files under that directory and in its subdirectories)

    RewriteRule (.*).htm$ /$1.php"
    This is a "regular expression" that says:
    (.*).htm$
    - Match (first position in the expression) and remember (the parentheses) any string that contains any number of any characters (the "dot" means any character followed by the "asterisk" which means any number of them) followed by the characters ".htm" at the end of the filename (the "$" means at the end of).
    /$1.php
    - Take the match ("$1" means the first pattern matched) found by the previous expression (that's the "/" slash separating what to look for and what to do with it when found) and prepend the found pattern to the string of characters ".php" (the new file extension).

    So if you have a file named "something.htm" in your http://domain.com/ directory, this set of instructions causes Apache to "rewrite" the name of the file before other programs process it and deliver it to the client.

    RewriteEngine on
    RewriteBase [http://domain.com]/
    RewriteRule (something).htm$ /something.php"

    These instructions can go in a file named ".htaccess" (no quotes) in your root directory, or you can add it to your Apache httpd.conf file, save it, and restart your Apache web server. Modifying the .conf file works fastest, but you may not have access to the entire web server, in which case .htaccess may be your only option.

    Note that the filename will remain "something.htm" unless you change it yourself, but this will cause Apache and its application partners to treat the file as if it had the ".php" extension.






    g1smd
    Staff
    Joined: Jul 28, 2002
    # Posts: 10418

    View the profile for g1smd Send g1smd a private message

    Posted: 2004-Sep-09 18:54
    Edit Message Delete Message Reply to this message

    Why not set up the server so that HTM pages are parsed as if they were PHP pages?

    No need for the re-write rule then.




    mincklerstraat
    Joined: Eons Ago
    # Posts: 10

    View the profile for mincklerstraat Send mincklerstraat a private message

    Posted: 2004-Sep-16 18:04
    Edit Message Delete Message Reply to this message

    do yourself a favor and find yourself a tutorial, google 'mod_rewrite tutorial short urls' - example, http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html . This is not hard, but at first daunting enough to want a tutorial for it.


    You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
    1. You have not yet logged in, or registered properly as a member
    2. You are a member, but no longer have posting rights.
    3. This is a private forum, for which you do not have permissions.

    If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

    If you cannot find this message, click here to Re-Send it.

    If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

    Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

    New posts Forum is locked
    © 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions