Jump to content

Apache trailing slash [SOLVED!]


dickohead
 Share

Recommended Posts

Alright, way beyond frustrated with this problem at the moment, i have read more documentation that you can poke a stick at, and have tried so many possible combinations of RewriteRule and RewriteBase in as many .htaccess files as i have folders to fix. Restarted the apache server so many times it thinks it's running on windows.

 

Now....

 

I am running mandrake 10.0, with Apache 2, and no matter how many apparent solutions there are on the internet - not one of them work.

 

I have multiple folders accessible from the root directory of my website, one of them is:

 

tim/

and the other is

~tim/

 

one is the home page directory, the other for file uploads.....

 

now - when i go to:

 

domainname.com/tim - it won't redirect me to domainname.com/tim/ nor will it work with ~tim

 

Where and what do i have put in place so that anyone who makes a request on the address:

 

domainname.com/tim or /~tim will be redirected so that the index.php file loads up?

 

I have read the URL redirecting guide at Apache.org, and tried to put the following:

RewriteEngine  on
RewriteBase    /~tim/
RewriteRule    ^tim$  tim/  [R]

 

into the .htaccess file inside the /tim and /~tim folders - but it refuses to work, i have also tried to put:

RewriteEngine  on
RewriteBase    /~tim/
RewriteCond    %{REQUEST_FILENAME}  -d
RewriteRule    ^(.+[^/])$           $1/  [R]

into the root directory of my apache server - /var/www/html/.htaccess

 

and in the folders /tim and /~tim....

 

And yes the modules are loading in my httpd.conf file, and yes

UseCanonicalName on

is present....

 

Surely the code i am using is wrong, because nothing i do seems to work... and i am very close to giving in, which really hurts!!!

 

:help:

Edited by dickohead
Link to comment
Share on other sites

So you have /var/www/html/tim and in /tim is an .htaccess file pointing to /wherever yes?

Do you get a blank page on that url or does it just sit on your index page? Is the php module installed in apache?

Link to comment
Share on other sites

http://dickinson.homelinux.net i am using PHP currently, for multiple things, PHP is fine, and htaccess is fine: http://dickinson.homelinux.net/tim/ as you can see :D:

 

But - it just won't forward /tim to /tim/

Link to comment
Share on other sites

OK, i get asked for the user/password . When you enter that correctly it still shows the default site eh?

So maybe your ,htaccess file is not set up correctly to point to /tim ?

Have a look in your apache logs and it should list the error (hopefully) look for problems with AccessConfig, AccessFileName, AllowOverride, AuthName,AuthType etc.

Link to comment
Share on other sites

when i enter the username and password correctly i get sent to either:

/tim/ - which gives me my index.php file

or

/tim - which gives me nothing.

 

All i want to be able to do is have it so that when /tim is added to the domain name, it changes it to /tim/ that way the login works and the page comes up.

 

I will check the error files now, see if it mentions anything.

 

Thanks anon, i'll post what i find.

Link to comment
Share on other sites

httpd2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

 

So i changed that in my httpd.conf file, there was also a favicon.ico error about 300 times, so i just put a tux icon in :P, but now when i log in to:

dickinson.homelinux.net/tim it promtps me for a username and password twice, but it redirects me to dickinson.homelinux.net/tim/ which is great!!!

 

But why do i have to log in twice now :unsure:

Edited by dickohead
Link to comment
Share on other sites

But why do i have to log in twice now  :unsure:

I had the same problem a couple of years ago, it drove me nuts. :D

When i found the answer on another website, i saved it for future reference;

When entering a password-protected web site for the first time, you will occasionally notice that you are asked for your password twice. This may happen immediately after you entered the password the first time, or it may happen when you click on the first link after authenticating the first time.

 

This happens for a very simple, but nonetheless confusing, reason, again having to do with the way that the browser caches the login information.

 

Login information is stored on the browser based on the authentication realm, specified by the AuthName directive, and by the server name. In this way, the browser can distinguish between the Private authentication realm on one site and on another. So, if you go to a site using one name for the server, and internal links on the server refer to that server by a different name, the browser has no way to know that they are in fact the same server.

 

For example, if you were to visit the URL http://example.com/private/, which required authentication, your browser would remember the supplied username and password, associated with the hostname example.com. If, by virtue of an internal redirect, or fully-qualified HTML links in pages, you are then sent to the URL http://www.example.com/private/, even though this is really exactly the same URL, the browser does not know this for sure, and is forced to request the authentication information again, since example.com and www.example.com are not exactly the same hostname. Your browser has no particular way to know that these are the same web site.

Link to comment
Share on other sites

so the only way to fix that would be to some how let apache know all the addresses it is known as, and redirect it to one global one.... that way it will only log in once, to the redirected one..... i think....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...