Mobile app version of vmapp.org
Login or Join
Deb1703797

: Rewrite URLs to add a slash 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

@Deb1703797

Posted in: #Htaccess #ModRewrite

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

When the / is not at the end of 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 example.com/user/myUserName/ and still redirect to /user/index.php.

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

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Deb1703797

2 Comments

Sorted by latest first Latest Oldest Best

 

@Moriarity557

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?

10% popularity Vote Up Vote Down


 

@Shanna517

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme