I have a site that is going to have information about local bands. right now a band's homepage URL looks like this: http://www.MySite.com/artist.php?artist=ArtistName I was wondering how I can make it look like this: http://www.MySite.com/ArtistName or possibly http://ArtistName.MySite.com
Sounds like a blog you have there. Usually blogs have settings that permit you to set this. The two options you described are kind of different. I'll describe the first one you wanted http:// domainname.com/ArtistName. [Note: I have to put extra spaces in because this forum software won't let me spell it correctly, because this forum software thinks it's a live link.] If you have a wordpress blog, here's how and where to fix that -- (1) HTACCESS FILE -- You'll need shell access, and see if you have an .htaccess file in the html root (usually the 'public_html' folder). If you don't have one, type 'touch .htaccess' and it will create one. Then type 'chmod 777 .htaccess'. (Don't copy my quote marks.) This makes the .htaccess file writeable. I've heard that on some systems you can type chmod 755 .htaccess, but that doesn't work on my system. Wordpress will need a writable .htaccess file to do some trickery in order to make the filenames as you are describing them. (2) PERMALINKS -- This is the word used by Wordpress to describe what you were asking for. The 'permanent link' at the end of your URL can be of the format ?p=255, or it could be of the format '2008/07/26/samplepost', or several other formats. To change Wordpress from the default format (?p=123), go to the admin page, and on the right, click settings. Then on the resulting menu, click 'Permalinks'. You'll see several choices. None *exactly* match what you requested, but you can do it in two steps. (a) Click on 'Month and Name'. Notice that the last item 'Custom Structure' just suddenly changed and now it says '/%year%/%monthnum%/%postname%/. (b) Now click on the last item 'Custom Structure', and erase the stuff at the beginning, leaving only /%postname%/ When you click the Update button, Wordpress will write some magical gobblygook into the .htaccess file, and what's reallyl happening is that, internally, it's still ?p=123, but now some translation is going on, and to the outside world (including you) it looks different Because now, if your 'article' is named 'ArtistName' then the URL of your article will be http:// domainname.com/ArtistName Now, that second format you mentioned. Perhaps there is a way to do that, but normally I've only seen that format when somebody created a subdomain, and then installed the blog on the subdomain, and then the blog's name would appear as the first word, like this -- http:// blogsname.yourdomainname.com Maybe somebody else here knows more about that.
I'm glad some people found it helpful, but this isn't for a blog, this is for a site I'm coding myself. I need a little more understanding of the 'magical gobbledygook'
i suggest having this one http://ArtistName[dot]MySite[dot]com because it's more friendly for spiders and easier to optmize. just only my suggestion hope it helps you.
If you are coding it yourself, how did you then come to name some page '?p=123'? Or, said different, how did that page come into being? Normally on a hand-coded site, a human wouldn't name a page in that manner. That type of 'page name' is a reference made by a language/database type of page generator, such as a blog. I'm sure that when the problem becomes more clear, the solution will also.
I'm not quite sure what happened. I was editing that last reply, as I realized you must mean that you are either (a) hand-coding a php/mysql application or possibly (b) using forms with the 'get' method. Those are the only two things that would cause a pagename in that format that I know. If you're hand-coding php/mysql and you'd like to know more about how the blogs solve the problem, it does have to do with the .htaccess file. You can google .htaccess and find tutorials, or you can read the apache manual under the subject of 'Mod_rewrite'. Sorry. I had a much nicer and longer response, but the forum software threw me out and threw it away.
Awesome. Thanks for your help! Yeah, it's a PHP/MySQL application that I'm making myself. I didn't know it had to do with the .htaccess file, but I'll look into it. You're definetly off to a great start on this forum.
Hey, if anyone else was wondering about this, I found this article really useful: http://www.total-php.com/article/8/using-search-engine-friendly-urls-for-your-dynamic-pages/