Welcome Guest, Not a member yet? Register   Sign In
problem with rewritting
#1

[eluser]global_erp_solution[/eluser]
I tried to access web page using /servername/first/order.
my controller name is order_controller.php. so in my htaccess:
Code:
RewriteEngine On

RewriteCond $1 !^(index\.php|robots\.txt|css|js|pics)
RewriteRule ^(.+)$ /first/index.php/$1_controller [L]

and I got 404 page not found. the rewritelog:
Code:
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] strip per-dir prefix: D:/Apache/apache-httpd-2.2/apache-php-webapps/first/order -> order
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] applying pattern '^(.+)$' to uri 'order'
(4) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] RewriteCond: input='order' pattern='!^(index\\\\\\\\.php|robots\\\\\\\\.txt|css|js|pics)' => matched
(2) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] rewrite 'order' -> '/first/index.php/order_controller'
(1) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] internal redirect with /first/index.php/order_controller [INTERNAL REDIRECT]
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] add path info postfix: D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php -> D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php/order_controller
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] strip per-dir prefix: D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php/order_controller -> index.php/order_controller
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] applying pattern '^(.+)$' to uri 'index.php/order_controller'
(4) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] RewriteCond: input='index.php/order_controller' pattern='!^(index\\\\\\\\.php|robots\\\\\\\\.txt|css|js|pics)' => not-matched
(1) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] pass through D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] add path info postfix: D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php -> D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php/order_controller
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] strip per-dir prefix: D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php/order_controller -> index.php/order_controller
(3) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] applying pattern '^(.+)$' to uri 'index.php/order_controller'
(4) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] RewriteCond: input='index.php/order_controller' pattern='!^(index\\\\\\\\.php|robots\\\\\\\\.txt|css|js|pics)' => not-matched
(1) [perdir D:/Apache/apache-httpd-2.2/apache-php-webapps/first/] pass through D:/Apache/apache-httpd-2.2/apache-php-webapps/first/index.php

What's wrong? thanks
#2

[eluser]InsiteFX[/eluser]
.htaccess should be in the root folder with index.php

Code:
php_value default_charset utf-8

Options FollowSymLinks
Options -Indexes
DirectoryIndex index.php

RewriteEngine On

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

[eluser]global_erp_solution[/eluser]
but I have several web apps, and the other are not using CI. some are for cake. that's why I didn't put it in root.
#4

[eluser]InsiteFX[/eluser]
It goes in the root folder of your CodeIgniter installation were index.php is.
#5

[eluser]global_erp_solution[/eluser]
yes, index.php is inside "first" folder along with the rewrite. however, following security guide, the application and system folder are outside root. everything works just fine with this setting if the rewrite is disabled. anything wrong?
#6

[eluser]global_erp_solution[/eluser]
all of my controllers are suffixed with _controller, but I'm hoping by using rewrite, I can omit the _controller part. Even when I change my rewrite to this:
Code:
RewriteEngine On
RewriteRule ^order$ /first/index.php/order_controller [L]

/first/order still returned 404. Why is this?
#7

[eluser]global_erp_solution[/eluser]
solved it. Dunno what's wrong, but apparently some virus did this (or is it trojan?) did the trick. thanks for the help and thanks to my antivirus.
#8

[eluser]InsiteFX[/eluser]
Microsoft has every free now for Viruses if you run Windows.

Microsoft Security Essentials

And for Root Kits, Trojon's and Viruses:

Windows Defender Offline

And they also update their deffinition files two to three times a day and weekends.




Theme © iAndrew 2016 - Forum software by © MyBB