LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Backslash in URL (https://www.linuxquestions.org/questions/linux-newbie-8/backslash-in-url-39415/)

Cynthia Blue 12-26-2002 11:43 AM

Backslash in URL
 
Just a little question...

Setting up some directories on my server. When I go to:
http://www.cynthiablue.net/fur/forums/
I can reach the page. However, typing in:
http://www.cynthiablue.net/fur/forums
gives me a not available error. How come that last backslash is mandatory, and is there a setting I can change that will allow the URL without a backslash?

Thanks. :)

speedracer05 12-26-2002 01:12 PM

Hello Cynthia Blue,

Are you running Apache? If so, you can alter the ServerName of your httpd.conf file to allow for the URL to work without the trailing slash... please refer to a previous post:

http://www.linuxquestions.org/questi...threadid=27052

Happy Holidays :)

Cynthia Blue 12-26-2002 01:33 PM

Ah excellent thank you! I did a search, but didn't know what to search for. :)

Errrr and yes I'm running Apache. :)

Cynthia Blue 12-26-2002 07:51 PM

Okay I went to my conf file and tried it... I'm still not able to browse to the directory without a slash. Forgive me, I'm very new to Linux.

My Servername was set to mydomain.com... I changed it to www.mydomain.com, and no change. The Apache page says:

Quote:

If you are using name-based virtual hosts, the ServerName inside a <VirtualHost> section specifies what hostname must appear in the request's Host: header to match this virtual host.
I have my main domain name (only one I currently have on there atm), set as the Default Virtual Host. I added a second URL just for fun (it's not real, I figured it can't hurt) in the virutal host section. On my primary URL virtual host section the ServerName is _default_:80. When I try to change this to www.cynthiablue.net, I am unable to restart httpd... the error I get is:
httpd failed. The error was: Stopping httpd: [ok]. Starting httpd (99)Cannot assign requested address: make_sock: could not bind to address 198.IP:80 no listenign sockets aailable, shutting down [failed].

I'm lost. :p

speedracer05 12-28-2002 01:49 AM

If you are using www.mydomain.com literally, and "hostname" does not reflect www.domain.com, then it will not work. Apache is not going to recognize www.mydomain.com on your server and resolve properly.

Try using your IP number for the ServerName. Use ifconfig to find the IP number for your server.

Just out of curiosity, I see your domain is hosted through Verio, did you have Verio direct your domain to your server?

Thanks.

Cynthia Blue 12-28-2002 09:56 AM

My domain name registrar is namesdirect, and my dns manager is verisigndns. I have verisigndns pointing to my static IP provided by my ISP.

I tried the external IP address, and the internal IP address in Server Name.. still not working. :p

I still can reach my server by typing in my domain name. That seems to work fine reardless of what my ServerName is set to. Hrm.

speedracer05 12-28-2002 01:28 PM

If you shutdown Apache, then try to access your site, are you still able to view your site? It may take a little while for the DNS to be updated before you can actually see your changes.

Can you access your site locally? I mean using http://localhost/fur/forums/? If so, try updating httpd.conf, then restarting, and checking your changes locally.

Thanks.

Cynthia Blue 12-29-2002 12:28 PM

Hmm.. not sure we are understanding each other. I can access my site fine, and I haven't made any changes to my dns manager. Changing the ServerName doesn't seem to be changing whether I can access my site or not. The only problem I'm having, is getting apache to differentiate between a file and a directory. If there is no slash, it thinks it's a file, and I get page not found. If there is a slash, it goes to the right page in the directory.

Maybe I'm not understanding what you mean... Each time I make a change, I've shut down and restarted apache. :)

Thanks.

speedracer05 12-30-2002 05:06 PM

Sorry for the delay... been doing the holiday travel thing :)

Please try the following:

/etc/rc.d/init.d/httpd stop

Now try accessing your site:

http://www.cynthiablue.net

Are you able to see your site?

If so, the changes that you make to Apache will not take affect immediately. Otherwise, if you make changes to your ServerName, you will need to wait a little while before your changes take affect.

snocked 12-30-2002 06:11 PM

Actually that's a forward slash.

DeezNutz 12-30-2002 08:55 PM

I'm having sort of a similar problem. (It mat or may not be related to Cynthia's problem, but I'll throw it out there anyway.)

I put a few pictures in a directory under the html root. When I access it from behind my router, everything is peachy. If I try to access the folder from outside it only works with the trailing "/". It looks like when the "/" is left off, apache tries to send it to the local ip addy (192.168.1.X) instead of the ISP assigned IP or even the name. (I set up an account with No-IP, so I can access my systems without having to try to find the IP address when I'm not at home.

Hopefully this will shed some light on the problem.

Cynthia Blue 12-30-2002 09:15 PM

Per my original post :) it's not the main domain name that is the problem. It's the subdirectories/filenames.

This:
http://www.cynthiablue.net/fur/
works okay (yeah slash, I always get them confused :))

But this:
http://www.cynthiablue.net/fur
Does not (if you click on the links, you will see what I mean. :)

So, it seems apache thinks that the url with no slash is a file, and cannot find that file, because I don't have a file of that name. It's a directory. :)

Oh, and yes, if I stop apache, then I cannot see my site. It's pretty instantaneous.

speedracer05 12-31-2002 02:01 PM

Okay, I just wanted to make sure that your changes were instantaneous.

If you are behind your router, refering to DeezNutz post, you could use your local IP for the ServerName and the trailing slash problem should be rectified.

Another option would be to use a rewrite rule:

http://httpd.apache.org/docs/misc/rewriteguide.html

Look under "Trailing Slash Problem".

Cynthia Blue 12-31-2002 02:13 PM

My DSL Modem acts as a router...

I'll read over that info, too, thanks. :)

speedracer05 01-02-2003 03:08 PM

I should have included this in my previous post...

Here is what your httpd.conf should look like with an example rewrite rule for your "fur" directory (assuming that your root directory is /var/www/html):

# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Indexes Includes FollowSymLinks

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
#
# HERE IS OUR REWRITE INFORMATION
#
RewriteEngine on
RewriteBase /
RewriteRule ^fur$ fur/ [R]
</Directory>

I hope this helps.


All times are GMT -5. The time now is 03:03 PM.