Search code examples
.htaccess

htaccess - Redirect /something/* to /something


Examples:

/something/foo --> show /something
/something/foo/bar --> show /something
/something/foo/bar/baz --> show /something

I'll parse the URL with JS.

Also, in my machine the route is localhost/websites/MyWebsite/something so ideally it should also work for my machine (or if it's not possible, I need to .htaccess one for the server and one for my machine)


Solution

  • Well nobody answered so after a lot of testing this worked for me:

    RewriteRule ^something/(.+)$ something.php
    

    In my case it was a php file