mod rewrite keeps routing to ROOT

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

mod rewrite keeps routing to ROOT

Postby MikeS999 » 02. January 2009 15:36

I wonder if anyone can help please?

I am setting up a 'friendly URL' facility and every time mod rewrite is called it tries to send the browser to the XAMPP root, blocked only by the Username/Password that pops up to protect this level [If already logged in, the stored cookie permits access to the XAMPP front page]

The .htaccess file resident in the appropriate subdirectory "/test/" says;

RewriteEngine on
RewriteRule ^index/([0-9]+)$ /index.php?cat=$1

The function is to take an incoming URL such as "http://www.domain.com/test/index/45" and convert it to "http://www.domain.com/test/index.php?cat=45"

In fact it sends the browser to "http://www.domain.com/xampp/"

Any advice would be very much appreciated. Many thanks for reading this plea!
MikeS999
 
Posts: 4
Joined: 02. January 2009 15:25

Re: mod rewrite keeps routing to ROOT

Postby Wiedmann » 02. January 2009 15:45

Code: Select all
RewriteRule ^index/([0-9]+)$ /index.php?cat=$1

Because of the "/" in "/index.php?cat=$1" mod_rewrite must call a "index.php" in the DocumentRoot (which makes a redirect to the XAMPP dir)

If mod_rewrite should call a "index.php" in the current subdir, just remove the slash:
Code: Select all
RewriteRule ^index/([0-9]+)$ index.php?cat=$1
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: mod rewrite keeps routing to ROOT

Postby MikeS999 » 02. January 2009 15:52

Wow,

What a very speedy response and thank you so much for your guidance. Needless to say it now works!

Cheers!

MikeS
MikeS999
 
Posts: 4
Joined: 02. January 2009 15:25

Re: mod rewrite keeps routing to ROOT

Postby MikeS999 » 02. January 2009 17:16

Sorry to be a nuisance, but....

Firing up "http://www.domain.com/test/index/471" does indeed execute the correct call ["http://www.domain.com/index.php?cat=471"]

For some strange reason everything now appears to be on a virtual sub directory 'index' i.e all links are now preprended with "http://www.domain.com/test/index/"

An example: A link to a help page resident in the root of /test/ normally showing

"www.domain.com/test/help.php"

now shows
"http://www.domain.com/basic_db/index/help.php" - the "/index/" part is added into every link.

This might explain why the root-based CSS file isn't seen.

Any ideas?
MikeS999
 
Posts: 4
Joined: 02. January 2009 15:25

Re: mod rewrite keeps routing to ROOT

Postby Wiedmann » 03. January 2009 01:13

"http://www.domain.com/basic_db/index/help.php" - the "/index/" part is added into every link.

mod_rewrite doesn't change links in the html source code. Your PHP script ('friendly URL' facility) is creating the links, including the additional "/index/" part.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: mod rewrite keeps routing to ROOT

Postby MikeS999 » 03. January 2009 10:14

Hi,

Thanks for that. I apologise for possibly posting an inappropriate request in this forum!

I realised in the early hours that I need to code to enable absolute addressing as opposed to relative!

Cheers and many thanks for your wise counsel,

Mike
MikeS999
 
Posts: 4
Joined: 02. January 2009 15:25


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 27 guests