Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know how to rewrite URLs to redirect to a page.

When the / is not at the end of www.example.com/user/myUserName the redirect works:

RewriteRule /$ /user/index.php

When I write RewriteBase / the above rule does not work, but a 404 error.

How to add a / at the end of www.example.com/user/myUserName/ and still redirect to /user/index.php.

This can be written into the .htaccess or httpd.conf.

share|improve this question

migrated from serverfault.com Feb 27 '11 at 19:04

This question came from our site for system and network administrators.

@johnConde I am hoping people provide an answer to my question – Jean Feb 27 '11 at 19:17
Me too. :) – John Conde Feb 27 '11 at 19:20
@johnConde that would totally nullify your purpose of redirecting this question from serverfault to prowebmaster – Jean Feb 27 '11 at 19:25
I didn't do it. The moderators or users of ServerFault did it. They did it because this question belongs here, not at that site. And believe it or not questions get answered here, too. ;) – John Conde Feb 27 '11 at 19:28
FWIW, the mention of RewriteBase with regards to the above directive is irrelevant. Since the RewriteRule substitution is root-relative (ie. starts with a slash), the value of RewriteBase is not used. – w3dk Dec 10 '15 at 15:26

Your english seems a bit confusing...

But from what I gather, the regular expression in your pattern isn't correct.

I belive you're trying to match everything to /user/index.php so try it this way:

RewriteRule /(.*)$ /user/index.php
share|improve this answer
That would hold good for www.MyDomainName.com/x1e, would it be good for if the domain is www.MyDomainName.com/x1e/ – Jean Feb 28 '11 at 7:42
Absolutely, that catches all requests and sending them to /user/index.php – Dani Mar 6 '11 at 12:09

The problem is that you're referring to a directory that doesn't exist. Is the .htaccess file in the root directory of you're server?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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