Solution 1 :

This should do the trick.

RewriteRule ^.*$ api/index.php [R=301,L]

And, if it’s just a typo. Your file must be named .htaccess.

Problem :

My directory structure in apache is as follows:

turkr/
     public_html/
                api/
                index.php
                .htacess

index.php is my front controller for my APIs, so every endpoint should be directed to this file. So far I’ve accomplished this with this in my api/.htacess file:

RewriteEngine on
RewriteRule ^(.*).php/$ /~turk/api/$1.php [R=301,L]

However, instead of using www.example.com/~turkr/api/index.php/someTable, I’d like to remove the index.php and so that it is a bit cleaner:

www.example.com/~turkr/api/someTable

I’m new to .htaccess files so any help is appreciated 🙂

Comments

Comment posted by MrWhite

/~turkr/api/index.php/someTable

Comment posted by turkr

The rule should be using ~turkr, sorry! Are you saying it isn’t doing anything?

Comment posted by MrWhite

If the URL as stated is the URL you are currently requesting then yes, that rule is not doing anything. What do you think that rule is doing? Also, the

By

Leave a Reply

Your email address will not be published. Required fields are marked *