1

I have the following rewrite rule:

RewriteRule ^support/(.*)$ /blog/support/$1 [R=301,NC,L]

However, all it does is a simple redirect. What I want to is for /support to show the contents of /blog/support without changing the URL from /support. How can I do this?

In addition, the above only works when /support has a trailing slash.

marked as duplicate by Jenny D, dawud, Katherine Villyard, mdpc, Falcon Momot Feb 24 '14 at 0:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

If /blog/support corresponds to a location in the file system, say /var/www/blog/support, then you can just use

Alias /support /var/www/blog/support

The documentation for the Alias directive says that the second argument has to be a file or directory path though, not another URL.

If you want an internal redirect only, so the user doesn't see the URL change, then probably all you need to do is remove R=301, from the flags in your RewriteRule.

To keep from requiring the trailing /, test for either a slash or end-of-line:

RewriteRule ^support(/.*|$) /blog/support$1 [NC,L]
  • Ok that works, it looks like the issue is something else as I keep getting a 404. I will mark this as the correct answer and ask another related question. – Abs Dec 27 '13 at 14:57

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