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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts

    htaccess mod rewrite

    hi all

    i have a url
    Code:
    http://localhost/vineet/description.php?id=13
    i want to change it to
    Code:
    http://localhost/vineet/description/13
    i have htaccess file in "vineet folder". i m using in htaccess below lines
    Code:
    options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^/description/([0-9]+)$ /description.php?id=$1
    when i type in the browser
    Code:
    http://localhost/vineet/description/13
    everytime it gives me error 404 object not found

    i have mod rewrite enable in apache

    vineet

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Try removing the leading slashes, like
    Code:
    RewriteRule ^description/([0-9]+)$ description.php?id=$1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts

    htaccess

    Quote Originally Posted by abduraooft View Post
    Try removing the leading slashes, like
    Code:
    RewriteRule ^description/([0-9]+)$ description.php?id=$1
    hi abduraooft

    i tried what u suggested. it works well but my images and css are not showing.

    how can i exclude images and css folder from rewriting

    vineet

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,866
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    How about
    Code:
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^description/([0-9]+)$ description.php?id=$1
    ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Jun 2008
    Posts
    173
    Thanks
    2
    Thanked 9 Times in 9 Posts

    htaccess

    Quote Originally Posted by abduraooft View Post
    How about
    Code:
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^description/([0-9]+)$ description.php?id=$1
    ?
    hi abduraooft

    i m facing two problems.

    1) with earlier code in which we removed slash
    i m able to view page
    Code:
    http://localhost/vineet/description/11
    without images and css

    but when i click my index.php which is at
    Code:
    http://localhost/vineet/index.php
    it changes the path and gets redirect to
    Code:
    http://localhost/vineet/description/index.php
    this is going to wrong path.

    vineet


  •  

    Posting Permissions

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