Forum Moderators: phranque
www.domain.com/name
to point to www.domain.com/folder_name/index.php
Which would allow me to do this, but they all point to the same index file.
www.domain.com/name1
www.domain.com/name2
www.domain.com/name3
RewriteRule ^([^/]+)/index\.php$ /folder_name/$1 [L]
Also want it to work with both trailing slash / and without...
This works to the sense that anything in the root dir will point to the location of the folder name... :( I only want the names I specity. I appreciate any help here :)
Please provide an explicit list of at least three full URLs (use example.com, please) and their corresponding filepaths.
Being specific will help you define the problem more clearly, and help you get a more useful response as well.
One thing that helps is to indicate what parts of the desired filepath(s) are fixed, and what parts are variable, for example, here's one possible interpretation of your description:
Requested URL .......... actual server filepath
example.com/name<0-9> -> /folder_name<0-9>/index.php
-or-
example.com/name<0-9>/ -> /folder_name<0-9>/index.php
In this case, "name", "/folder_name", and "/index.php" are literal strings, while the name-number is to be copied from the URL to the filepath.
Jim
The description you outlined above was on track :) That's what I'm trying to do. Hope this makes it a bit more clear.
This seems to be doing to trick, but will not work without the trailing slash /
RewriteRule ^([^/]+)/$ /Nevada/index.php?cityid=$1 [L]
RewriteRule ^([^/]+)/?$ /Nevada/index.php?cityid=$1 [L]
In some cases, the search engines will get around to discovering that the two URLs actually point to the same page, and they will discard one of the URLs... BUT...They pick which one to keep, not you.
Taken to extremes of dozens or hundreds of duplicates, there may indeed be an actual penalty invoked, but in most cases, the "penalty" is simply self-inflicted ranking dilution as described above.
Whether (sub)domains, protocols, URL-paths, or query string formats, it is best to accept one and only one URL and permanently redirect all other variations to that one "canonical" form.
Jim
So I don’t know if it is possible to check, if a dir exists go there, otherwise go to the /Nevada/index.php location, and ignore anything in the root /index.php or /file.php
I also would like both versions with or without the / slash, because somebody that will type that in will get the page and not a page not found error. I would do a 301 permanent redirect on the version without to the version with.
A more efficient way to do this is to put "Nevada" into a "virtual" subdirectory called (for example) "states" which makes the need for the rewrite explicit, instead of having to check your disk for files and directories on every URL request.
Jim