Hi All....

I have developed a portal in mvc and i am having problem in making the links SEF...
right now if i need to access controller and method i am following

www.xxxxxxxx.com/index.php?rt=CONTROLLER_NAME/METHOD_NAME

i want to make the above link SEF like
www.xxxxxxxx.com/CONTROLLER_NAME/METHOD_NAME

Below code i have it in my .htaccess file but when i tried to run it its saying INTERNAL SERVER ERROR

.htaccess

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

Maybe you don't have module mod_rewrite, in the apache web server.

I agree with radow here. There's nothing syntactically wrong with your rewrite conditions or rule. The HTTP 500 error you're receiving is likely because mod_rewrite is not enabled. Do you have any other configuration details in your .htaccess file that may be causing the 500 error? If not, I would change your rewrite body to this:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
</IfModule>

If the 500 error stops occuring then you've confirmed mod_rewrite is not enabled. Either enable it in your Apache configuration or contact your host to do it for you.

@Deepak,

Once you have confirmed re write is enabled, you also need to set your base:

RewriteBase / = these makes "/" the return for where all rewrites will start from. Looking at what you have posted this is a key item that is missing.

Also for the rule itself:

RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?rt=$1 [L]

I hope that helps

Thanks all...
Got it working...

Can you advise what u did so it can be searched for other users?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.