Page 1 of 1
URL rewriting php xampp
Posted: Wed Jul 01, 2009 3:27 am
by shaam
Hi guys,
Im using php and xampp and i want to rewrite my urls from dynamic to static for SEO purpose and also to secure urls,
For Example let say i have a dynamic URL
http://www.widgets.com/product.php?cate ... oductid=10
and i want to convert it to this one
http://www.widgets.com/product/
How can i do this by using .htaccess in xampp ????
Thanks
Re: URL rewriting php xampp
Posted: Wed Jul 01, 2009 9:23 am
by BornForCode
Code: Select all
# Externally redirect extensionless URLs to add a trialing slash (this is non-HTTP-compliant and not recommended)
RewriteCond $1 !([^/]+/)*([^.]+)$
RewriteRule ^(.*[^/])$ http://www.example.com/$1/ [R=301,L]
#
# Internally rewrite extensionless trailing-slashed URLs to php scripts
RewriteRule ^([^.]*)/$ $1.php [l]
Re: URL rewriting php xampp
Posted: Thu Jul 02, 2009 1:38 am
by shaam
Thank for yuor reply,please tell me where i should write this code ?? and what settings required in xampp ???
Thanks
Re: URL rewriting php xampp
Posted: Thu Jul 02, 2009 6:42 am
by SeaJones
I've had issues with Xampp and url re-writing, I don't think it has the rewrite module installed as default. Run a phpinfo() command to see if you can see it listed.
If it is there, the code Bornforcode sent you goes into .htaccess in the same directory as the files you wish to affect., usually the site root.
Re: URL rewriting php xampp
Posted: Thu Jul 02, 2009 6:54 am
by shaam
Thanks SeaJones,
Yes i installed that mod_rewirite module by changing file httpd.conf,
But its not working yet,
Please send me sample .htaccess code if u have any ???
Re: URL rewriting php xampp
Posted: Thu Jul 02, 2009 8:52 am
by SeaJones
Have you got a phpinfo output to check it's working properly? And which version of Apache are you running?
If you don't know what I mean, run this file on your Xampp install:
and see if you can see mod_rewrite listed under the installed modules. If it's not there, then you don't have i installed correctly.
The code you need for htaccess was posted earlierby BornForCode, why not buy him a beer?

Re: URL rewriting php xampp
Posted: Thu Jul 02, 2009 9:32 am
by shaam
Thanks for ur reply,
Yes as i told earliar that i have installed mod_rewrite and i checked it,
my php version is PHP Version 5.2.6,
there is no issue of mod_rewrite,the issue is in .htacess file.
do u have any idea why the apache server is unabled to call .htacess while url scanning???
is there any issue of code in .htacess or something else ?
Thanks