Re: Ensuring all links go to index.php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The way you do or don't tear apart the original URL to get user and
login, as well as the URL you send out will affect this.

If your URL starts with "/" then it is an "absolute" URL, and the
browser won't put the current "directory" (from its perspective) in
front of it.

It's also possible you just tore the URL apart wrong, and aren't
sending out what you think you are sending...  Use "View Source" in
your browser to see what you sent.

On Fri, October 20, 2006 3:00 am, Dave M G wrote:
> PHP List,
>
> This problem is a little hard to describe. Please forgive me in
> advance
> if it's not clear.
>
> I have set up my .htaccess file to work with my PHP script to create
> "friendly URLs".
>
> For example, the URL mysite.com/user/login will take the user to a
> page
> where a user logs in.
>
> It does this by stripping everything out except "user" and "login". It
> takes "user" and creates a "user" object, and then passes a "login"
> method to that class to take the user to the login page.
>
> Somehow, in this process, the local URL is becoming "mysite/user",
> even
> though I'm just using that "user" designation to drive the creation of
> objects from classes.
>
> So, for example, I have a link to logout which is simply
> href="user/logout".
>
> But when I mouse over it, and look at the status bar at the bottom of
> my
> FireFox browser window, it says that the link points to:
> mysite.com/user/user/logout
>
> That URL, obviously, doesn't work for my system. It tries to make a
> "User" object and call a "user" method which doesn't exist.
>
> So... my question is, why is the /user portion of my URL being
> retained
> as a directory?
>
> I thought it had something to do with setting headers. I want
> everything
> to operate through the index.php file in my root directory, so I
> thought
> I could do that by putting this at the top of the index.php page:
>
> header("Location: /");
>
> Or:
>
> header("/local/server/www/directory/");
>
> Bottom line is, how do I ensure that all links and user requests
> through
> the URL end up going to the index.php in my web site's root directory?
>
> I hope this question is clear enough, and thank you for any and all
> advice.
>
> --
> Dave M G
> Ubuntu 6.06 LTS
> Kernel 2.6.17.7
> Pentium D Dual Core Processor
> PHP 5, MySQL 5, Apache 2
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux