Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 4 of 4
  1. #1
    DNF Regular

    Join Date
    Feb 2004
    Location
    AL
    Posts
    521
    DNF$
    3,627
    Bank
    0
    Total DNF$
    3,627
    Donate  

    mod_rewrite guru around?

    I have an index.php in my root directory that pulls content from sub-folder. The URLs end up looking like this: http://www.domain.com/?page=some-page-name where some-page-name is the name of the sub-folder. I want to use mod_rewrite in an .htaccess file to rewrite so the URLs look like this: http://www.domain.com/some-page-name.htm

    Anyone have an idea? I have read and reread some many articles trying to figure this out.

  2. #2
    DNF Regular
    DNGeeks's Avatar
    Join Date
    Jan 2005
    Location
    Winnipeg Canada
    Posts
    625
    Country

    Canada
    DNF$
    10,316
    Bank
    0
    Total DNF$
    10,316
    Donate  

    Re: mod_rewrite guru around?

    This is an example and won't work "as is". It will take some modifying. You may also need to modify each page or the code for the pages to support the new styles of links.

    note - i am NOT an expert, I simly copied these from a script I currently use and modified them slightly.

    rewriteEngine on
    rewriteBase /
    RewriteRule ^page-(.*)-(.*)-(.*).html page.php?cat=$2&pg_which=$3

    or

    rewriteEngine on
    rewriteBase /
    RewriteRule ^page-(.*)-(.*).html page.php?id=$2

  3. #3
    Account Terminated
    Join Date
    Mar 2005
    Location
    Canarian Islands
    Posts
    234
    DNF$
    1,602
    Bank
    0
    Total DNF$
    1,602
    Donate  

    Re: mod_rewrite guru around?

    basically
    http://www.domain.com/?page=some-page-name
    means
    http://www.domain.com/index.php?page=some-page-name

    so
    index.php?page=$1
    then look to what to rewrite
    ([A-Za-z0-9_-]*)

    so you get
    RewriteRule ^([A-Za-z0-9_-]*).html index.php?page=$1

    happy rewriting

  4. #4
    DNF Regular

    Join Date
    Feb 2004
    Location
    AL
    Posts
    521
    DNF$
    3,627
    Bank
    0
    Total DNF$
    3,627
    Donate  

    Re: mod_rewrite guru around?

    Thanks folks. I ended up using this to get it to work.

    RewriteEngine On
    RewriteRule ^(.*).htm /?page=$1

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
  •  

Domain name forum recommended by Domaining.com