Welcome Guest, Not a member yet? Register   Sign In
How remove index.php from URLs? [SOLVED]
#21

[eluser]Unknown[/eluser]
[quote author="rufnex" date="1274482561"]try this:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
[/quote]

thanks bro, it works for me.
#22

[eluser]tison[/eluser]
Guys,

This is what I used, this not only removes index.php, but also redirects non-www traffic to www (if you are using non-www, simply remove the middle 2 rules):

Code:
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
#23

[eluser]Unknown[/eluser]
Thanks, Its working....
#24

[eluser]Sanjib Kumar Jena[/eluser]
Thanks a lot it works
#25

[eluser]Unknown[/eluser]
Maybe this will help to those who still seems to have a problem:

in your config file there is a setting called $config['index_page']. makes sure its empty before you try to use mod_rewrite.

You might have added there something while following the tutorial.
#26

[eluser]ibnclaudius[/eluser]
[quote author="vertexdata" date="1324229135"]1. Please ensure “Options FollowSymLinks” is done for the directory in which CI is installed. This is done in the httpd.conf file. In your httpd.conf file you need to add the following lines. Make sure that you change the Directory to the one relevant to you (/Users/Ashok/Sites/starwood2012 - This should be changed in the following code block to your CI installation directory).

<Directory “/Users/Ashok/Sites/starwood2012”>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

2. The .htaccess file should be in the CI installation directory. To me you sounded like you have it in your application directory.

3. In the contents of the .htaccess file you provided - I see you do not have the RewriteBase line. Please add this line.

RewriteBase should be everything between your domain name and the controller with NO trailing /

Please refer once again to my original post and ensure the you have the RewriteBase with the correct path in it.

Thanks.[/quote]

I solved the forbidden error, had to add this line to my .conf:

Quote:Options +Indexes +FollowSymLinks +ExecCGI
#27

[eluser]mvnkarun222[/eluser]
I can't able to remove index.php from the url.....I tried many codes...........Can anyone tell me how to remove index.php
#28

[eluser]mvnkarun222[/eluser]
I need help of removing index.php from URL.I tried all these codes mentioned but not even one working for me..............................
#29

[eluser]Unknown[/eluser]
[quote author="mvnkarun222" date="1387885220"]I can't able to remove index.php from the url.....I tried many codes...........Can anyone tell me how to remove index.php [/quote]

Try this

1.Open the httpd.conf
2. find
Code:
LoadModule rewrite_module modules/mod_rewrite.so

3. remove #
4. Find AllowOverride then change to be

Code:
<Directory />
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

5. Save then restart apache
6. Create .htaccess at the root directory
Code:
#REWRITE index.php
#START USING REWRITE ENGINE
RewriteEngine On

#REWRITE CONDITON
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#WHEN YOU FOUND index.php IT WILL REWRITE To / AUTOMATICALLY
RewriteRule .* index.php/$0 [PT,L]


7. Change the application/config.php

Code:
$config['uri_protocol'] = 'REQUEST_URI';

Code:
$config['index_page'] = '';

8. Save and test it

Hope it can help you.
#30

[eluser]kminx[/eluser]
I'm running CodeIgniter on a shared server and none of these .htaccess examples worked for me. I've used this with both CodeIngiter and PHP-MVC. Works for both. Put this .htaccess in whatever directory you installed CodeIgniter.

# Necessary to prevent problems when using a controller named "index" and having a root index.php
# more here: http://httpd.apache.org/docs/2.2/content...ation.html
Options -MultiViews

# Activates URL rewriting (like myproject.com/controller/action/1/2/3)
RewriteEngine On

# Disallows others to look directly into /public/ or other restricted folders
Options -Indexes

# When using the script within a sub-folder of your root web domain, put this path here, like /mysubfolder/
# If your app is in the root of your web folder, then leave it commented out
RewriteBase /CI/

# General rewrite rules
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]




Theme © iAndrew 2016 - Forum software by © MyBB