InMotion Hosting Support Center

Should I enable clean URLs using the temporary URL?

Category: Drupal 7

2013-09-19 3:28 pm EST

Hits: 1,478
I have a temporary url for my site as it is not ready to go live on my domain. I would like to enable clean urls while still using the temporary url. This is important as I am building Drupal menus and if I enable clean urls after the menus are built they may not work correctly. Can I enable clean urls to work both for my registered domain name AND my temporary url?

You must login before you can ask a follow up question.

You must login before you can submit an answer.



42,973 Points
2013-09-19 4:50 pm EST
Hello Adambackstrom,

Thanks for the question! If you are developing a website and you want to avoid complications with the URL after you go live, you should be using what's called a HOSTS FILE modification. This way, you can simply use your domain name and set it so that the computer will think the URL is resolving to our hosting server. You can actually specify the IP that a URL will resolve to. So, set your to resolve to our server and then leave the non-WWW name alone. That way, if you type www.domain_name.come, it will resolve to the server here. This ONLY changes the URL for YOUR computer (or wherever you're developing). That way, you can see the website resolving normally with the non-WWW version and see the results of your development work using the WWW version of the URL. You can also set the search engine friendly URLs to use the proper domain name and avoid having to make changes after you're ready to go live.

Click on the link above and you'll see the instructions on how to set your HOSTS file. Please let us know if you require any further assistance.

Arnel C.

You must login before you can post a comment about this answer.

Hi Arnel,

Thanks for the answer. I agree that this would work for fixing an issue on my local machine. My issue is that I am trying to build menus within Drupal as it is hosted on the inmotion servers. I want a menu option to resolve to site/node1 but without clear urls Drupal defaults to site/?q=node1. I want to get rid of the params (?q=) part of my urls and test it before the site goes live. It is also worth noting that I already have a live site at this domain name on another host, so I don't want to cut over until development on this site is complete. I would prefer to not have to hack the site to make this work temporarily, which is why I was hoping I could have clean urls enabled now.
11 Points
2013-09-19 5:05 pm EST
Hello Adam,

I think there's a little mis-understanding here. Clean URLs are used to provide simpler, easier to understand URLs that search engines would prefer. Making a HOSTS file mod does NOT hack the site or change anything about a website. It simply makes it easier for you to deal with the issue of developing using the actual domain name.

Yes, I understand that you have a live site. If you make a HOST file modification, you can designate one of your URLS - I was suggesting the WWW version, so that ONLY your computer would recognize that the URL is resolving to our hosting computer here. The "temporary URL" is simply another URL that can be used to get to the domain hosted with us. You are stating that you want to enable "clear URLs" -also called search engine friendly URLs. The problem with setting up the temporary URL on your site is that when you do so, ALL of the URLs being generated for your temporary site will require that temp URL. Then when you're finished with it and ready to go live, you'll need to go and change the configuration files and possibly the database with the live URL. This will only cause you more work.

This is not a hack - web developers use it all the time to make their lives easy when developing a site. It enables you to use the actual LIVE url at your desktop. Making a host file modification means that only YOU (or anyone on your computer) will see that particular URL resolving to the server here.

For example:

Let's say your live domain name is

The web browser can resolve that domain name to either (a typical web server is configured to recognize either URL):

And by default, the browser KNOWS that the URL goes to a particular server on a different hosting service. To illustrate how a HOSTS file modification works we'll make up an imaginary IP address like The IP for your site here will be 456.456.456.456. Currently when you type in, the site will go to However, with a hosts file mod you can change where a particular URL resolves to, but only for your computer.

You can literally change the IP location for to someplace else. So what will happen is this: goes to goes to 456.456.456.456 (after the HOSTS file modification)

This means that you can use the actual LIVE domain name (albeit with "www") on your computer to go to the development server. Again, this is would only resolve to that IP address on the computer where you make the HOSTS file modification. You can then turn ON the "clean URLs" and instead of something like:

Your URL will look like:

And that is what you're trying to ultimately accomplish. Basically, ignoring all this long-winded explanation of what a HOSTS file mod does, I'm trying to save you some steps (and headaches of editing your config or database). I do understand what you're trying to accomplish, and using the hosts file you can definitely do this. Hosts file mods are simple one-line edits. You can apply and then remove it any time. It's not a "hack" but a useful option that you can easily make so that you can define where certain URLs will go.

If after all of this, you still want to the temporary URL, you will need go into the files for your Drupal installation, find the SITES folder, determine the site you are using (if you have more than one), select that folder, and then edit the SETTINGS.PHP file. You would need to change/enable the BASE URL there and change it to the temp URL. By default, the BASE URL line is typically disabled. You will see it commented out with a "#" in front of the line. We recommend that you do NOT make any posts or references to graphics when you're using the temp URL. This is to prevent possible entries that use the temp URL because you would be changing that URL to something else when you go live.

When you go live, you would then simply change the BASE URL setting to the real URL (or make it a comment again by adding the "#" sign).

We have been suggesting to use the HOSTs file modification in these cases in order to prevent making unnecessary changes to settings or configuration files for your application installation. This helps to prevent possible confusion and possible file path issues when the site goes live. However, it is your choice!

I hope this helps to clarify what a Hosts file mod does. I have also provided the information you need to change the Base URL for your Drupal installation.

Arnel C.
42,973 Points
2013-09-19 6:15 pm EST

Thanks again for responding. I think the misunderstanding is because I was not specific enough on the nature of the problem. I am familiar with making HOSTS file modifications. I did not mean to imply that is a hack. The problem I am having is very specifically that I could not enable the clean urls feature within Drupal. Without being able to enable that feature the clean formatted menu links saved in my database will not work. Since the feature is disabled, modifying my HOSTS file still won't fix the problem. (The locations for each menu link are using the relative path, so they would not need to be updated once the full url changes.) I should have said that I want to enable clean urls correctly without having to use a workaround to make them work.

When I spoke with tech support I asked them if they could help me modify the .htaccess file to enable clean urls, as I was not sure what change needed to be made (and because the inmotion documentation says to contact support if clean urls are not working: Tech support did not know how to do this so they suggested I post the question here.

As it happens I was able to solve the problem myself. Here is what I did:
In my public_html/.htaccess file I uncommented the RewriteBase property and changed the value to /~myusername/. This allowed me to enable clean urls in Drupal admin and proceed with what I need to do. When the time comes to point my domain at this site I will obviously need to change that property again, but the menus should still work because they just reference the nodes and not the absolute paths.

I appreciate your help and I hope this answer is useful to anyone else who might have the same problem.



11 Points
2013-09-19 9:50 pm EST
Like this Question?

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

Need more Help?

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!