Is it compulsory that URL and folder name are same
Is it compulsory that URL and folder name are same. If not I have a folder say temp and I want URL is like http开发者_如何学C://www.test.com/te*&mp
How would I do that?
The mod_rewrite is for that purpose which shows virtual paths as like folders. There are number of tutorials to following. Also note that you can change your file extension or remove also in the URL path through this. Also this makes easy for users and search engine rankings.
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
http://www.sitepoint.com/guide-url-rewriting/
You may want to read on htaccess and URL Rewriting
You can use Apache's mod_rewrite
to redirect requests made to te&mp
to the proper temp
folder. You won't be able to use *
as it isn't an allowed character for a file name (Windows, it is allowed on a POSIX system).
RewriteEngine On
RewriteRule ^te&mp/(.*) temp/$1 [L,QSA]
Also note that since &
is a reserved character, you'll need to URL encode it (te%26mp
).
No, it isn't. See the Alias directive.
精彩评论