0

When running site on localhost and using field rewrite I construct a link like this for example

<a href="/[uid]/addresses/shipping/default/[profile_id_1]">Set as default</a>

I get a path that is not proper. Something like this

http://localhost/1/addresses/shipping/default/284 

and it is missing a site part in url and should be like

http://localhost/MY-SITE/1/addresses/shipping/default/284

I have set a $base_url in settings.php but doesnt help. When I put site online this works fine, but what should I do for localhost?

1
  • Have you modified your RewriteBase in the .htaccess file? Commented Nov 30, 2014 at 21:46

1 Answer 1

0

You need to alter your .htaccess file:

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
5
  • I made this now, restarted cache and localhost just in case but still nothing :( Still the url is without the base. Just localhost/user/.... and should be localhost/my-base/user...
    – Blissful
    Commented Dec 1, 2014 at 13:48
  • Think it might be the way you're constructing your URLs in Views, change the options to: 1. Under Rewrite the output of this field change to just "Set as default" 2. Under Output this field as a link change to [uid]/addresses/shipping/default/[profile_id_1] Commented Dec 2, 2014 at 9:28
  • Problem is that I need to have it in "Rewrite the output of this field" as I have combo of HTML, and the other problem is why isn't views using proper path in this case?
    – Blissful
    Commented Dec 2, 2014 at 17:48
  • 1
    Your method is not passing through the l function and will always have the wrong path what additional HTML do you need Commented Dec 3, 2014 at 18:11
  • Makes sense, thanx
    – Blissful
    Commented Dec 4, 2014 at 14:03

Your Answer

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

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