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

Problems with the Windows version of XAMPP, questions, comments, and anything related.

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

Postby drewjuk » 27. January 2012 10:32

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
drewjuk
 
Posts: 4
Joined: 07. January 2012 12:25
Operating System: Windows 7 Pro, x64

Re: .htaccess is redirecting me to xampp home page

Postby Sharley » 27. January 2012 10:44

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. :)
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: .htaccess is redirecting me to xampp home page

Postby drewjuk » 27. January 2012 10:53

Thanks took both of, job done! works!!!!

Thanks for your help :)
drewjuk
 
Posts: 4
Joined: 07. January 2012 12:25
Operating System: Windows 7 Pro, x64

Re: .htaccess is redirecting me to xampp home page

Postby Sharley » 27. January 2012 10:58

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 44 guests