...

View Full Version : htaccess mod rewrite



vineet
12-13-2008, 12:16 PM
hi all

i have a url


http://localhost/vineet/description.php?id=13


i want to change it to


http://localhost/vineet/description/13


i have htaccess file in "vineet folder". i m using in htaccess below lines


options +FollowSymLinks
RewriteEngine on
RewriteRule ^/description/([0-9]+)$ /description.php?id=$1


when i type in the browser


http://localhost/vineet/description/13


everytime it gives me error 404 object not found

i have mod rewrite enable in apache

vineet

abduraooft
12-13-2008, 12:53 PM
Try removing the leading slashes, like

RewriteRule ^description/([0-9]+)$ description.php?id=$1

vineet
12-13-2008, 01:06 PM
Try removing the leading slashes, like

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

abduraooft
12-13-2008, 01:17 PM
How about

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^description/([0-9]+)$ description.php?id=$1 ?

vineet
12-13-2008, 01:36 PM
How about

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


http://localhost/vineet/description/11

without images and css

but when i click my index.php which is at


http://localhost/vineet/index.php


it changes the path and gets redirect to


http://localhost/vineet/description/index.php

this is going to wrong path.

vineet



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum