user2814461
user2814461

Reputation: 37

Error Re Write Rule

I am using a rewrite rule that got off a learning video

but it is not working properly

Options +FollowSymLinks
Options -Indexes

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

I would like it to pick up if just type in http://www.example.com/hmvctest/helloworld

but it only works if i type in http://www.example.com/hmvctest/index.php/helloworld

currently only shows "No input file specified" I use codeigniter and cpanel I have tried the two answers below and still no luck my site uses https

Upvotes: 1

Views: 28

Answers (2)

anubhava
anubhava

Reputation: 785316

Try replacing your rules with this:

Options +FollowSymLinks -Indexes -MultiViews

DirectoryIndex index.php

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/(index\.php|images/|robots\.txt) [NC]
RewriteRule ^ index.php%{REQUEST_URI} [L] 

Upvotes: 1

Punitha
Punitha

Reputation: 152

Use this code
 <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /www.example.com
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>  

Upvotes: 0

Related Questions