Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2007
    Posts
    317
    Thanks
    24
    Thanked 3 Times in 3 Posts

    how to Add underscore to .htaccess file

    Hi guys,

    I have a url like this

    example.com/folder/folder/a_unique_article.html

    my .htaccess file is giving me an error when i have the underscore within the field. So my question is how can i add it to my .htaccess file so it doesn't give an error.

    here is what i have already.

    Code:
    RewriteEngine On
    RewriteRule ^folder/([A-Za-z0-9-]+)$ folder/category.php
    RewriteRule ^folder/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)\.html$ folder/article.php?title=$2
    Thanks for the help.

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    371
    Thanks
    0
    Thanked 20 Times in 20 Posts
    How are you adding it? (What is the code that is giving you the error?)

    Try
    Code:
    Options +FollowSymLinks
    
    RewriteEngine On
    
    RewriteRule ^folder/[-a-zA-Z0-9_]+$ /folder/category.php [QSA,L]
    RewriteRule ^folder/[-a-zA-Z0-9_]+/([-a-zA-Z0-9_]+)\.html$ /folder/article.php?title=$1 [QSA,L]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •