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).

  • 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 Dec 11 '12 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 Dec 13 '12 at 13:19
  • @MPD Sounds promising, I've had a go but not been able to get anything working – Clive Dec 14 '12 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? – Marek Sotak Dec 14 '12 at 11:45
  • 1
    @James it works for me :) try to add an answer and win +500! – kalabro Dec 14 '12 at 11:49
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".

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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