• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.