please help with this htaccess code

Discussion in 'PHP' started by shrinath, Dec 21, 2011.

  1. #1
    this is my htaccess code.

    Options +FollowSymLinks
    Options +Indexes
    
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?couponcoder\.in)$ [NC]
    RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]
    
    RewriteRule ^admin$ Admin/index.php?qstr=$1 [L]
    RewriteRule ^(.*)/$ index.php?qstr=$1 [L]
    
    ErrorDocument 404 /404.php 
    
    Code (markup):
    I want to remove the slash at URL end
    from
    http://couponcoder.in/ZOVI.com/
    Code (markup):
    to
    http://couponcoder.in/ZOVI.com
    Code (markup):
    can anybody help to fix this?
     
    shrinath, Dec 21, 2011 IP
  2. dujmovicv

    dujmovicv Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    4
    Trophy Points:
    48
    #2
    
    RewriteCond %{HTTP_HOST} !^\.yourdomain\.com$ [NC]
    RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] 
    
    Code (markup):
     
    dujmovicv, Dec 21, 2011 IP
  3. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #3
    try this..
    
    RewriteRule ^(.*)$ index.php?qstr=$1 [L]
    
    Code (markup):
    are you trying to redirect with slash to without slash?
     
    JohnnySchultz, Dec 22, 2011 IP
  4. shrinath

    shrinath Well-Known Member

    Messages:
    275
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    100
    #4
    This code is working.
    but its not displaying 404 for invalid URL,

    I mean site loads correctly for http://couponcoder.in/Letsbuy.com
    and its not showing 404 for invalid URL http://couponcoder.in/Letsb (invalid) its displaying homepage for invalid URL
     
    shrinath, Dec 22, 2011 IP