Page 1 of 1

.htaccess is redirecting me to xampp home page [SOLVED]

PostPosted: 27. January 2012 10:32
by drewjuk
When I try use my .htaccess file it redirects me to xampp home page the .htaccess file works fine on my server.

I have looked at various website telling me to uncomment mod_rewrite etc.. but it all seems to be done and nothing makes a difference.

here is my local URL: http://localhost/folder/website/product/Toyota/75

And here is my .htaccess file:

Options -Indexes
Options +FollowSymLinks

#Rewrite engine
RewriteEngine on
RewriteBase /
RewriteRule ^product/([-0-9a-zA-Z_\s]+)/([0-9]+)$ /index.php?product=$1&pid=$2&sp=1 [L]

Anybody got any ideas what is wrong?

Thanks for your help

Re: .htaccess is redirecting me to xampp home page

PostPosted: 27. January 2012 10:44
by Sharley
If the .htaccess file is in the same folder as the index.php file then from the / slash in front of the index.php entry.
The /index.php is the index.php file in the htdocs folder - the forward slash being the htdocs folder (DocumentRoot).

Also the rewrite base / is telling Apache to look in the htdocs (DocumentRoot) folder.

Change that to the base directory of where you want the rule to start from, for example the same place as the .htaccess file is located or the web root of your web site - or drop it from the rule and see if you can move on.

Your issues are with knowing the paths that you want the rewrite rule to affect ie relative or absolute.
Your .htaccess file is using absolute paths (starting in the htdocs folder) when you should be using relative paths to your web root or location of the .htaccess file.

If there was no index.php file in the htdocs folder you would have a server 404 file not found error or a server 500 error relating to the .htaccess file and the error.log file would be the place to investigate those error.

HTH

Good luck. :)

Re: .htaccess is redirecting me to xampp home page

PostPosted: 27. January 2012 10:53
by drewjuk
Thanks took both of, job done! works!!!!

Thanks for your help :)

Re: .htaccess is redirecting me to xampp home page

PostPosted: 27. January 2012 10:58
by Sharley
You're most welcome. 8)

I will close this topic and mark it solved.

Please feel free to start a new topic if you have any more issues with XAMPP for Windows.