Welcome! Log In Create A New Profile


Convert rewrite apache rulers

Posted by hussan 
Convert rewrite apache rulers
October 05, 2011 11:49AM
Hi, i have this rewrite in my application:


<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*\.(png|gif|jpg|jpeg|js|css|swf))$ webroot/img_handler.php?arg=$1 [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
# test 5
# disable directory browsing -IMPORTANT, do NOT remove.
Options -Indexes
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
# disable the server signature
ServerSignature Off
# protect php.ini
<files *.ini>
order allow,deny
deny from all

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

how i can convert o nginx rewrite?

Re: Convert rewrite apache rulers
October 06, 2011 09:48PM

i make some rules to nginx:

location ~ \.(png|gif|jpg|jpeg|js|css|swf)$ {
rewrite ^ http://$host/webroot/img_handler.php?arg=${uri} permanent;

if (!-e $request_filename)
rewrite ^/webroot$ /webroot/ permanent;
rewrite ^/webroot/(.*)$ /webroot/index.php?url=$1 last;
rewrite ^/(.*)$ /webroot/index.php?url=$1 last;

when access site.com/controller show the content site.com/webroot/index.php?url=controller and work fine but i have one problem:

when access site.com/file.ext show the content site.com/webroot/index.php?url=file.ext but isnt corrent, i need show the site.com/webroot/file.ext

how i can make this?

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 189
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready