Go Back   APTHost Forums » AptHost Support Forums » Nginx
Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2008, 12:21 PM
hitch hitch is offline
New In Town
 
Join Date: Jan 2008
Posts: 4
hitch is on a distinguished road
Default htaccess rewrite help please?

Hi i am trying to rewrite my htaccess files with not much luck in finding documentation to help me do it. Here is the htaccess files. I'd love some pointers in the right direction

Code:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*) index.php?/$1 [E=VAR1:$1,QSA,L]

AddType text/x-component .htc
<FilesMatch "\.(htc)$">
SetHandler text/x-component
</FilesMatch>
my attempt below (please dont laugh at me

Code:
location ~ /\. {
    deny  all;}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
break;
}
Reply With Quote
  #2  
Old 11-27-2008, 04:31 PM
APT-Joe APT-Joe is offline
Guest
 
Join Date: Dec 2007
Posts: 17
APT-Joe is on a distinguished road
Default

You are right, if you added those rules it would work just fine.

Just one thing, we do care about the security of all of our customers in our servers, our master Nginx config, we have a predefined set of rules for all VirtualHosts, and one of them is to block any access to the outside of any .ht* files, so really, you shouldn't have to worry about it in your rewrite rules as its already in the master config.

Code:
location ~* /\. {
           deny  all;
}
You really don't need the break; in there, just abit neater:

Code:
if (!-e $request_filename) {
	rewrite ^/(.*)$ /index.php?q=$1 last;
}
Take care!
Reply With Quote
  #3  
Old 11-27-2008, 06:04 PM
hitch hitch is offline
New In Town
 
Join Date: Jan 2008
Posts: 4
hitch is on a distinguished road
Default

Thanks for the quick help! I have made changes you recomended. This is my last one that i dont really know where to start on. the htaccess file is:
Code:
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)|(\.swf)$ 

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
Reply With Quote
  #4  
Old 11-27-2008, 07:42 PM
APT-Joe APT-Joe is offline
Guest
 
Join Date: Dec 2007
Posts: 17
APT-Joe is on a distinguished road
Default

Here ya go:

Code:
if ( !-e $request_filename ) {
    rewrite (/|\.gif|\.jpg|\.png|\.css|\.js|\.php|\.swf|/[^.]*)$ /sapphire/main.php?url=%1&%$query_string last;
    break;
    }
}
Reply With Quote
  #5  
Old 08-15-2009, 01:18 PM
sebi123 sebi123 is offline
Forum Whiz
 
Join Date: Apr 2009
Posts: 111
sebi123 is on a distinguished road
Default

we do care about the security of all of our customers in our servers, our master Nginx config, we have a predefined set of rules for all VirtualHosts, and one of them is to block any access to the outside of any .ht* files, so really, you shouldn't have to worry about it in your rewrite rules as its already in the master config.
_________________________________
HOW TO BE A REAL ESTATE MILLIONAIRE NOW
FREE RBCExpressTerm Quote for Florida, Texas and Tennessee Residents
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:48 PM. Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.