0

My current .htaccess file is like this It hides .php from the url.

RewriteEngine on
RewriteBase    /
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Now I want to redirect my site to also remove www i.e I want to redirect http://www.thefutureshop.com.pk/index.php
to
http://thefutureshop.com.pk

My site is built using codeigniter.

2 Answers 2

1

You can use:

RewriteEngine on
RewriteBase    /
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,L,R=301]
RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Sign up to request clarification or add additional context in comments.

Comments

0

Try this

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

Replace:

$config['index_page'] = "index.php"
to
$config['index_page'] = ""

For more Read this http://w3code.in/2015/09/how-to-remove-index-php-file-from-codeigniter-url/

Comments

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.