Welcome Guest, Not a member yet? Register   Sign In
Codeigniter redirect to .php file using htaccess
#1
Question 

What I want to do is to redirect the execution to another php (Name: test.php) file placed with index.php
How the redirection should work:
Code:
http://localhost/skeleton/login
should be processed as
Code:
http://myserver/dev/index.php/login
(Which is the normal Codeigniter thing, and working fine at my end)
And
Code:
http://localhost/skeleton/test/login
should be redirected to
Code:
http://myserver/dev/test.php/login
This is where I am facing the issue.
My htaccess trial so far for it (By searching on SO and other sources by Google):


Code:
RewriteEngine On
RewriteRule ^test(.*)$ trial.php$1 [L,QSA]

# Also tried this, didn't work
# RewriteRule ^test/(.*)$ trial.php/$1 [L,QSA]

# Rewrite rule to remove index.php of codeigniter
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]


Need your help guys! Thanks in advance
Reply
#2

@akshitarora,

You may need to set your routing rules and or your $config['base_url'] value.

Setting your own routing rules: https://codeigniter.com/user_guide/gener...ting-rules

What is your $config['base_url'] set to in /config/config.php?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB