How does Remap Subdir work?


#1

I’m trying to arrange things so that a visitor who goes to

[quote]www.checkerbox.com/Naughton

[/quote]

ends up seeing

[quote]http://www.checkerbox.com/photocart/index.php?do=photocart&viewGallery=1085

[/quote]

which is their gallery in my shopping cart. I’m hoping to simplify things for them by providing the more direct URL above.

I thought I could use Remap Subdir to accomplish this. So I mapped

[quote]www.checkerbox.com/Naughton

[/quote]

to

[quote]/home/checkerbox/checkerbox.com/photocart/index.php?do=photocart&viewGallery=1085/

[/quote]

which is the path to their gallery. But it doesn’t work. I’ve waited 40 minutes for the remap to take effect, but I get a 404 not found when I go to www.checkerbox.com/Naughton.

I think I’m using Remap Subdir incorrectly. Can someone tell me what I’m doing wrong?

Thanks.


#2

It sounds like you really want to to a Redirect. Remapping is really for “physical” directories on the server, and not directories already in your site.

I’d create a directory Naughton, and inside, put a no-content index.html with a META Refresh tag in the header:

-Scott


#3

[quote]I thought I could use Remap Subdir to accomplish this. So I mapped

[quote]www.checkerbox.com/Naughton

[/quote]

to

[quote]/home/checkerbox/checkerbox.com/photocart/index.php?do=photocart&viewGallery=1085/

[/quote]

which is the path to their gallery. But it doesn’t work. I’ve waited 40 minutes for the remap to take effect, but I get a 404 not found when I go to www.checkerbox.com/Naughton.

I think I’m using Remap Subdir incorrectly. Can someone tell me what I’m doing wrong?[/quote]
File system paths are not URLs and vice versa. File system paths cannot have a query string or a fragment identifier.

To explain why remember the web site is run by a program called the web server. The web server must convert the URL-path to that of a file system path. Anything can be used as a url-path as long as it converts to something useful somehow.

The solution by sdayman is simple but maybe not the best for your situation. For example if you have many such “shortcuts” you would have to use an .htaccess file and either RedirectMatch directives or the URL Rewriting Enginge (mod_rewrite for short)

eg:

RedirectMatch ^Naughton$ http://example.com/photocart/index.php?do=photocart&viewGallery=1085

OR

RewriteEngine On
RewriteRule ^Naughton$ http://example.com/photocart/index.php?do=photocart&viewGallery=1085 [L]

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#4

OK, so the PHP parameters don’t convert to a file system path. That makes sense. But if I had wanted to redirect requests for www.checkerbox.com/Naughton to www.checkerbox.com/pictures/Naughton, would that have worked?

And yes, the HTML redirect that sdayman suggests does work, but as you say, I have a lot of these shortcuts. Creating a directory and a HTML redirector for each one is a hassle.

Thanks for the .htaccess idea. I didn’t know that could be done. I’ll try it.

Jonathan


#5

To get /Naughton to point to /pictures/Naughton, I’d create a symbolic link on the server:
log in to the server via SSH or telnet
’cd ~/checkerbox.com’
‘ln -s pictures/Naughton ./Naughton’

-Scott


#6

I think you are confusing terminology again. Remapping and redirecting are two different processes.

Remember a url-path has to be converted to a file system path. Normally the file system path will start with the [color=#6600CC]document root[/color] which DreamHost calls the [color=#6600CC]Web Directory[/color]. For example your Web Directory maybe [color=#6600CC]/home/username/checkerbox.com[/color] Having said that, normally url-paths like [color=#00CC00]/subdir/[/color] will be converted to the file system path [color=#6600CC]/home/username/checkerbox.com[/color][color=#00CC00]/subdir/[/color]

With a remap, the web server itself knows that a url-path starting with a certain directory path needs to “map” to a file system path starting at a certain directory path. So when a request comes in for [color=#00CC00]/subdir/[/color]index.php it knows it needs to access [color=#6600CC]/home/username/somewhere/else[/color][color=#00CC00]/subdir/[/color]index.php instead of [color=#6600CC]/home/username/checkerbox.com[/color][color=#00CC00]/subdir/[/color]index.php

A redirect is where a request comes in for the url-path /Naughton and the web server tells the browser to fetch /pictures/Naughton instead. To answer your question, you can remap only from url-path directories to file system directories. However you can redirect any URL to any other URL (including the query string parts).

NOTICE the browser is involved in a redirect but not a remap. Thus the visitor cannot tell if a URL was involved in a remap operation.

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7