8

The path '/profiles' exists as a physical folder in the root of a Drupal install, which means adding a URL alias for a piece of content to '/profiles' will not work - a 403 error is the result.

Lucky 'ol me, for a particular project I have an SEO partner telling me that using that particular path is an absolute, categorical must; not having this would be proof that the Myan's doomsday prediction is in fact accurate, we'll all die slowly, etc., etc.

So I'm going to go ahead and throw this slightly ridiculous question out to the masses to see if anyone's found a creative way to solve this problem before...

How can I use '/profiles' (and '/profiles/*', etc.) as URL aliases, while maintaining a fully functional, update-able Drupal instance?

Importantly, we're using the Global Redirect module, with the 'De-slash' and 'Non-clean to clean' options enabled (and they need to stay that way).

12
  • Never done this, hence a comment and not an answer, but since there isn't anything normally browsable in /profiles, I think your best bet is to add a RewriteRule to change the requested URL to another basepath. This should get you past the /profile problem. You then likely need to then inbound alter to remap back to /profile.
    – mpdonadio
    Commented Dec 11, 2012 at 21:25
  • 4
    This is probably a silly question but couldn't we just put this "RewriteRule ^profiles/(.*) /index.php?q=profiles/$1" at the top of the htaccess file to rewrite all requests to /profiles to index.php?q=profiles/% or would this cause problems with updates / security
    – James
    Commented Dec 13, 2012 at 13:19
  • @MPD Sounds promising, I've had a go but not been able to get anything working
    – Clive
    Commented Dec 14, 2012 at 11:38
  • 1
    How was your site installed? is it from default profile or using some sort of distribution that has its installation profile and modules within the profiles directory? Commented Dec 14, 2012 at 11:45
  • 1
    @James it works for me :) try to add an answer and win +500!
    – kalabro
    Commented Dec 14, 2012 at 11:49

1 Answer 1

11
+500

1) .htaccess (before line 100):

RewriteRule ^profiles($|/(.*)) /index.php [L]

2) VirtualHost (for de-slash setting):

<Location /profiles>
     DirectorySlash Off
</Location>

Second part is needed only if you use Global Redirect "de-slash".

2
  • Awesome, the DirectorySlash Off directive seems to have done the trick. Thank you :)
    – Clive
    Commented Dec 15, 2012 at 20:14
  • 1
    Brilliant. Well deserving of the bounty.
    – mpdonadio
    Commented Dec 17, 2012 at 16:00

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.