Welcome Guest, Not a member yet? Register   Sign In
Apache Rewrite for index.php and data.php
#1

[eluser]Lima[/eluser]
As I did before
config/config.php
Code:
$config['base_url'] = "http://www.mysite.com/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
$config['url_suffix'] = ".html";
$config['enable_query_strings'] = FALSE;

config/route.php
Code:
$route['default_controller'] = "page";

.htaccess
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

So far so good.
Now I need to add data.php on root web directory, so now I have index.php and data.php
data.php is url based on query string, so I need to enable query string
config/config.php
Code:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger']  = 'c';
$config['function_trigger']  = 'm';
It does not matter if it effected to index.php

if url is http://www.mysite.com/page.html no change so it will redirect to
http://www.mysite.com/index.php/page.html by .htaccess

if url is http://www.mysite.com/data.php?p1=data1&p2=data2
I need additional .htaccess code to redirect url http://www.mysite.com/data.php?p1=data1&p2=data2 to
http://www.mysite.com/data.php?c=datacon...1&p2=data2

Please somebody help me for this case. I don't have knowledge on apache mod_rewrite.

Thanks

Lima




Theme © iAndrew 2016 - Forum software by © MyBB