SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mod_rewrite via .htaccess

    My current url is of the following pattern:

    I want to rewrite it to:

    Unfortunately, my RewriteRule (see below) isn't achieving this. Anyone see where I went wrong with the rule? The .htaccess file is located in the htdocs of the Apache server. The code-igniter folder is a sub-folder within htdocs. And the numeric value is optional. Thanks.

    Code:
    RewriteEngine On
    RewriteRule ^(.*)/(*.)/(.*)   /code-igniter/$1.php/$2/$3

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

    Using the dreaded EVERYTHING atom is the height of folly (actually, laziness). It can only get you in to trouble.

    Saying that, your code should work so well that you loop (until Apache gets tired and quits - be lucky that you're not using Apache 1.x ESPECIALLY on a shared server as that took Apache down!).

    Even if you corrected your regex, you still have to deal with the MultiViews "problem" as Apache doesn't like to serve a file sitting in the place of a directory.

    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


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
  •