Question

I have a section of a website I'm building that is for the user's account pages.

The map of this bit of the site is like this:

*root*/account/details.php
*root*/account/subscriptions.php
*root*/account/options.php

I want to make it so that if a user goes to:

*root*/account

They are redirected to

*root*/account/details.php

The basic rewrite would be something like this:

RewriteRule ^account/ account/details.php [L]

However this rule means that all pages (subscriptions,options) also redirect to details which is obviously problematic.

How can I edit my rule so that it only redirects root/account to the details page, and leaves the other pages to work independently?

Was it helpful?

Solution

From what I understand you want to rewrite only /account/, but not /account/XXXX. In this case try: RewriteRule ^account/$ account/details.php [L] In this case '$' identified the end of the pattern, so nothing after /account/ will be looked at.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top