How do you "edit" the URL of your website? So instead of having the homepage be http://www.website.com/ it becomes http://website.com/ and then how would you make it so that instead of http://website.com/news.php it becomes http://news.website.com/?? Sorry that this is probably already been answered, I just cannot find the answer anywhere. Thanks in advanced.
-
This depends on the stack you use. Most likely you'll need to use a .htaccess file to achieve this. Google it and tell me if thats what you're looking for. I'll give you an example of how to do it then. – Markus Hofmann Aug 08 '13 at 19:56
-
This is done by editing your DNS entry and configuring your web server. Your domain registrar and web hosting provider can help you with this. If you need to do it yourself, Serverfault.com is a better place for questions like these. – nullability Aug 08 '13 at 19:59
-
The **www** prefix can be removed with a redirection in an .htaccess file in the root of your project on the server. As nullability said, the **subdomain** part is done with DNS configuration. Check ServerFault. – Markus Hofmann Aug 08 '13 at 20:00
-
@nullability hosting provider won't help with url routing – m0s Aug 08 '13 at 20:00
2 Answers
For redirecting to non www this link will do what you want Generic htaccess redirect www to non-www However redirecting to news.website is a sub domain so technically it would be a completely new website but this could be achieved by redirecting with htacess but you may loose traffic doing this with 301 redirects and seo sometimes don't work very well. Find this link anyway to redirect http://www.htaccessredirect.co.uk/

- 1
- 1

- 2,912
- 3
- 28
- 51
-
Thank you for answering half my question, and does .htaccess go in public_html or outside it? The subdomain doesn't fully make sense to me so how would you change the domain name into having a sub domain? So instead of naming it websitename would you do subdomain.website name? – user2565624 Aug 08 '13 at 20:08
-
A sub domain is technically a completely different website such as www. Is a sub domain on website.com you can configure this in your DNA setting or if you are using a control panel there maybe an option for a sub domain, otherwise speak to your host about creating one. The downside however on SEO however is that news.website.com is a completely new website and will not rank on google aswell as your original page. The htaccess file is saved in the public_html folder as .htaccess but with nothing in front of it, I believe. Here's an article about subdomains en.wikipedia.org/wiki/Subdomain – Liam Sorsby Aug 08 '13 at 20:36
You will have to take that up with your host service or server administrator. Removing "www" would change your DNS identification. A DNS service redirects traffic to an IP given the URL. Should your URL change, the DNS would have to be updated.
Simply put, it cannot be done in HTML (the contents of the page) because it is the method used to direct users to the content.
-
Surely by default www and non www should be specified in the DNS settings to avoid issues – Liam Sorsby Aug 08 '13 at 20:06
-
1Indeed, I was mistaken. It appears he can do whatever he likes with the subdomain. A DNS will direct traffic to the proper server given the final affix in the URL. It still must be done through configuration of the webserver. – Aug 08 '13 at 20:13