0
I am just learning mvc structure. In my mvc directory, 
I have a .htaccess file which contains this:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

The idea is to redirect all the requests to index.php like:
http://www.domain.com/mvc/test
will be
http://www.domain.com/mvc/index.php?url=test

It is working fine.

But when I am trying to pass this:
http://www.domain.com/mvc/index
hoping to be converted to
http://www.domain.com/mvc/index.php?url=index

But it is not working.

I’ve seen some tutorial videos where this works.
There must be some settings which I don’t know.
8
  • Welcome to stackoverflow. Your question is about basic redirect, it has nothing to do with MVC, so I removed mvc tag. Also, avoid horizontal scrolling of your text, it will make it more readable. Commented Jul 29, 2013 at 7:53
  • Do you have a directory or file in mvc directory, called "index"? Commented Jul 29, 2013 at 8:22
  • I have nothing called "index" in mvc directory. I just want it to treat "index" as any other non-existent phrase and want it to be redirected as '?url=index' as I've mentioned. But it is treating "index" as "index.php" and is not redirecting. Commented Jul 29, 2013 at 8:29
  • This video will help you to understand my problem. youtube.com/watch?v=Aw28-krO7ZM Commented Jul 29, 2013 at 8:36
  • Sorry, can't watch youtube from this machine. Are you sure, that it's treating index as index.php, it shouldn't do it. Can you redirect to google.com?q=$1 and check? Put R flag to RewriteRule. Commented Jul 29, 2013 at 8:43

1 Answer 1

3

Try to disable MultiViews in htaccess:

Options -MultiViews
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry. I forgot to mention. I've put the .htaccess file in mvc folder. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.