0

I have created an application in PHP MVC,and the http request was like domain.com/index.php?controller/action, i want to remove index.php? and the final url looks like http://domain.com/controller/action. Any help will be highly appreciated

currently my .htaccess file looks like below

RewriteEngine On
RewriteBase /
<IfModule mod_rewrite.c>
# Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

it only removes the index.php and the url become http://domain.com/?controller/action, i want that "?" to be off from the url.

3
  • Possible dupicate of stackoverflow.com/questions/4365129/… & many more. Commented Jan 24, 2013 at 12:04
  • research before asking questions Commented Jan 24, 2013 at 12:21
  • but it does not remove the "?" symbol, i want to remove index.php along with "?". i tried this one : ^(.*)$ /index.php?/$1 [L] but shows error. Commented Jan 24, 2013 at 12:23

1 Answer 1

1

use mod_rewire module to get the job done. What you are asking is SEO friendly URLs. If you search search a bit you will find a lot of examples.

put this in your root .htaccess file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your reply!! I tried it, but it only removes the index.php and the url become domain.com/?controller/action, i want that "?" to be off from the url.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.