SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    my code is not working, even after reading DKLynn's tutorial and I don't know why :(

    I have been banging my head but please tell me where I am going wrong with my code. I am trying to rediret to a another directory and .html splash page as you will see:

    # 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

    # 2. In your opencart directory rename htaccess.txt to .htaccess.


    # For any support issues please visit: http://www.opencart.com
    DirectoryIndex

    Options +FollowSymlinks

    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

    RewriteBase /site_begin/trial.html
    RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

    # Prevent Directoy listing
    Options -Indexes

    # Prevent Direct Access to files
    <FilesMatch "\.(tpl|ini|log)">
    Order deny,allow
    Deny from all
    </FilesMatch>




    Quote Originally Posted by dklynn View Post
    areol,

    You need to review a few things:

    1. The placement of the hyphen in a range definition makes it a metacharacter - e.g., to define a-d (a, b, c and d). To specify a hyphen character, it must be first (although last seems to be acceptable, too).

    2. The characters allowed with a URI are enumerated in a paper by Sir Tim Berners-Lee entitled Uniform Resource Identifiers (URI): Generic Syntax and you are attempting to use reserved characters. Clearly, if you violate the long-established rules for URIs, you will fail - as you have already proved.

    Do you need the list of characters I use at http://wilderness-wally.com?

    Regards,

    DK

  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)
    :bang:

    When you alter the URIs of a canned program, you run the danger of disabling the program's URI aliasing module.

    Code:
    DirectoryIndex 
    # WHAT? No files identified by this directive? It appears that index.php is the file used by opencart
    
    Options +FollowSymlinks
    # Probably redundant but it doesn't hurt.
    
    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 
    
    RewriteBase /site_begin/trial.html
    # This should NOT be a file, it should be the directory where the shop is located, i.e., / (the {DOCUMENT_ROOT})
    RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
    # What does that mean? IMHO, the regex part of this should be . and the $1 replaced by %{REQUEST_URI}
    
    # Prevent Directoy listing 
    Options -Indexes
    
    # Prevent Direct Access to files
    <FilesMatch "\.(tpl|ini|log)">
    # Don't forget your .htaccess file!
     Order deny,allow
     Deny from all
    </FilesMatch>
    It appears that you've modified opencart's mod_rewrite code (and more?). Perhaps it would be better to get the original file and try with that before making further modifications.

    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
  •