0

I host my site and a few others through Hostgator. When I build a new Drupal site as a replacement for an existing site at a different host, I build it on the IP address (192.xxx.xxx.xxx/~username) or on the corrado (Hostgator) url (corrado.websitewelcome.com/username). In both cases, I cannot activate Drupal's "Clean URLs" feature. Once the site is built and we are ready to point the domain name to the new site (and we do so), Clean URLs works fine. It is an issue, though, while I am still building the site, because I have to use absolute URLs in the CSS and the various content blocks for the links and images to work correctly, and that creates extra work during the website activation process where I have to go back in and remove all of those absolute URLs. I have tried modifying my hosts file so that the site's existing URL will resolve to the Hostgator IP address for that new site-in-progress, but this isn't enough to "fool" the Clean URLs function.

I already reached out to Hostgator support, and they did not have a solution for me. Any ideas on how I can work around this issue and get Clean URLs to work in this environment?

3 Answers 3

0

You can use relative css as long as you are pointing to files within your theme. That will work like this. url('img/image.jpg'); So no need for full url's here.

More explanation here: http://css-tricks.com/quick-reminder-about-file-paths/

At template level you might want to use drupal_get_path to point to the various modules and or themes.

7
  • How can I modify that CSS to point to files in an images dir in the root (public_html/images)?
    – hockey2112
    Dec 10, 2013 at 23:57
  • usually that is by prepending a slash. Like url('/images/image.jpg') Dec 11, 2013 at 0:03
  • Unfortunately, that does not work. When I add the prepending slash, it is looking for the image in 192.xxx.xxx.xx/images, while the correct directory would be 192.xxx.xxx.xx/~username/images
    – hockey2112
    Dec 11, 2013 at 0:13
  • And I assume it is not an option to move the images inside the template? Then your only option is to navigate trough the parenting folders. A file in public_html/sites/all/themes/style.css would use url('../../../../images/img.jpg'); Dec 11, 2013 at 0:19
  • This still does not work. The format you used above looks for the image in this directory: 192.xxx.xxx.xx/~username/sites/all/themes/mytheme/…. It seems as though no combination of "../" can overcome the username issue.
    – hockey2112
    Dec 11, 2013 at 15:54
0

Check for status of Rewrite module, whether it is enabled or not. If it is not enable it and restart your Apache server (Hope you using Apache). still if it is not working then check the Allow override settings in the virtual host file or default site file for the specific project folder.

AllowOverride all

If the value is None the change it to all. Once again restart the web server and check you can activate clean url feature.

0

It can help you.
Go to /admin/config/search/clean-urls
you will get example.com/?=admin/config/search/clean-urls in your address bar
remove ?= from address bar so that your url become example.com/admin/config/search/clean-urls
press enter
Now you will get a check box
tick that box and save configration.

May this Helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.