Author Topic: domain.com/sub.directory.with.dots.in.it/filename.php  (Read 2260 times)

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
domain.com/sub.directory.with.dots.in.it/filename.php
« on: June 24, 2010, 04:57:23 PM »
is this a valid file path?  domain.com/sub.directory.with.dots.in.it/filename.php

it seems to work but I'm worried its, at a minimum not best practice but more so that it will eventually break my site.  While browser compatibility is important, I'm also worried about it breaking in apache.

I have a site that have several alias domain name but I need to store content in a file structure sorted for each domain.

The easiest thing to do would have file paths like:

/var/www/html/domain1.com/
/var/www/html/domain2.com/
/var/www/html/domain3.com/ 

can I have those dots in there?
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: domain.com/sub.directory.with.dots.in.it/filename.php
« Reply #1 on: June 24, 2010, 05:17:13 PM »
I generally prefer not to use dots in my code as it can have random issues (like content negotiation). I use dashes/underscores instead. But, it's OK as long as your software is designed to handle it correctly. Google does it for their Apps URLs.
e.g.
https://www.google.com/a/domain.com
https://mail.google.com/a/domain.com
This signature intentionally left blank.

Dumah

  • Jackass IV
  • Posts: 960
  • Karma: +21/-6
Re: domain.com/sub.directory.with.dots.in.it/filename.php
« Reply #2 on: June 24, 2010, 05:23:14 PM »
Are we talking about URLs of file paths

Either way I think both can be ok on Linux/Apache but both will probably have a problem if you ported to Windows/IIS (as if you would for PHP...but nevermind)

I would choose not to though...too easy to mistake a folder for a file and extension and usually I can create enough confusion without adding that into the mix!

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: domain.com/sub.directory.with.dots.in.it/filename.php
« Reply #3 on: June 24, 2010, 05:26:50 PM »
Are we talking about URLs of file paths

Either way I think both can be ok on Linux/Apache but both will probably have a problem if you ported to Windows/IIS (as if you would for PHP...but nevermind)

I would choose not to though...too easy to mistake a folder for a file and extension and usually I can create enough confusion without adding that into the mix!

actually, probably just file paths and not URLs as I intend to mask/alias the directory to the end user

so a link: real-domain.com/sites/domain1.com/files
looks to the end user like: real-domain.com/media/files

I plan to use an .htaccess re-write like this:
RewriteRule ^media/(.*)$ /sites/%{HTTP_HOST}/$1

so actually the browser will never see the period in the file structure (unless at some point I decided to hard-code in the full file path somewhere in the site instead of using the alias)
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

Mike

  • Jackass In Charge
  • Posts: 11257
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: domain.com/sub.directory.with.dots.in.it/filename.php
« Reply #4 on: June 24, 2010, 05:28:28 PM »
Don't foresee any problems with it

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: domain.com/sub.directory.with.dots.in.it/filename.php
« Reply #5 on: June 24, 2010, 06:58:00 PM »
thanks guys!
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."