Welcome! Log In Create A New Profile

Advanced

centminmod .htaccess help please?

Posted by The RealGlenn 
centminmod .htaccess help please?
September 11, 2013 12:40PM
I have been pointed in this direction in regards to converting an apache .htaccess file to work with the excellent centminmod script. The original file look like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1 [R=301,L]

</IfModule>

I have tried using the online converter (http://www.anilcetin.com/convert-apache-htaccess-to-nginx/), but the output it gave me didn't work. I presume it IS just a case of replacing the above with the conversion output in the .htaccess file?

Thanks for any help you can give.
Re: centminmod .htaccess help please?
September 11, 2013 03:15PM
Just to update, this code:

if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite /. /index.php last;
}
if ($http_host ~* "^www.(.*)$"){
set $rule_1 1$rule_1;
set $bref_1 $1;
}
if ($rule_1 = "1"){
rewrite ^/(.*)$ http://$bref_1 permanent;
}

seemed to work when I eneterd it into the following file in /usr/local/nginx/conf/conf.d:

mydomain.com.conf

woohoo!

Rather than having to add this to every domain I add manually, how can I make it so it adds this code every time automatically?

Thank you for any help with this.
Re: centminmod .htaccess help please?
September 06, 2015 12:46PM
htaccess on centminmod script? ==> you can try l2mp script: http://l2mp.ml
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 215
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready