Click to See Complete Forum and Search --> : Questions about Clean URLs and Cookies...


jderosa3
03-13-2008, 10:09 AM
I have two questions... hopefully this is the right forum for them... I apologize in advance if they are not.

1) Concerning Clean URLs... I assume we have all seen (mainly on CMS and BLOG sites) these nice URLs that show no files names or queries at the end of the URL.

Is there any way to do this to more simplistic sites... for instance.

Instead of having:

http://www.mydomain.com/contact.php

have

http://www.mydomain.com/contact/ (or something else that does not show the file name of the page)

I would like to start making the sites I design look a little neater all around.


2) I have a flash intro to a site (I know people are starting to hate these), but I do have concern for these individuals. Is there a way to use a cookie that will keep track if a user views a page and if so... they are moved to another.

Example: I have the intro on index.html and the main site on index2.html. If the visitor already viewed index they will be moved to index2.

This is for an ad agency site - so the flash I think might be expected, but as I said for usability purposes I want to keep track of the visitors...

Thanks for any help.

Kind Regards,
James

dtm32236
03-13-2008, 11:44 AM
regarding question #1:

http://www.mydomain.com/contact/
is the same thing as
http://www.mydomain.com/contact/index.php (or .html)

so if you point the user to the directory (/contact/), then the url remains 'clean', and they are really seeing the index page.

Does that make sense?


And for #2... what you are looking for is possible, but beyond my skills. Hopefully someone else can help you with that.

jderosa3
03-13-2008, 12:34 PM
No... maybe I wasn't clear. I guess in the end... is there any way not to display the page file name in the address bar.

If the contact.php was in the site root for example... I would want the address to say just "http://www.mydomain.com/" not "http://www.mydomain.com/contact.php"

is this a better example?

Detect
03-13-2008, 12:41 PM
It's not really standard to keep the address bar static (poor usability), but you could do it if you put everything in an IFRAME.

jderosa3
03-13-2008, 01:13 PM
Maybe I just won't do that then... I thought it would be better - guess not though.

Anyways... what about the cookie thing? anyone have any ideas?

ss1289
03-13-2008, 01:19 PM
you can do it within your .htaccess file. It's called a RewriteRule, google it.

It takes the url within the url bar and checks to see if it matches any of the first arguments of a RewriteRule and if it does then it redirects the user to the second argument of that RewriteRule.

Example:
RewriteRule ^(.*)$ http://other.example.com/$1

^(.*)$ - is the url shown to the user. In this case anything in the url matches this RewriteRule through this regular expression. You can set this to "^contact/$"

http://other.example.com/$1 - is the url that the user is directed to. $1 is the argument that is contained with the parenthesis of the first argument. You can set this to "/contact.php"

so then you have:
RewriteRule ^contact/$ /contact.php

note: the user cannot see the contact.php part, they'll only see http://www.mydomain.com/contact/ in the address bar but the page showing will be contact.php

jderosa3
03-13-2008, 02:19 PM
nail on the head... thanks!

dtm32236
03-13-2008, 02:39 PM
It's not really standard to keep the address bar static (poor usability), but you could do it if you put everything in an IFRAME.

I agree with this... keeping the URL static would restrict the user (it would definitely piss me off), and it's kind of pointless if your url is http://www.mydomain.com/contact.php. This is already a pretty nice and clean url.

I'd say to leave it as is...