Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Need help with Apache to Nginx Rewrite Rules

I have an apache .htaccess that I need to convert to Nginx in order to run on my LEB.

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php?/$0 [PT,L]

I followed some converters online and it gave me this

# nginx configuration location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?/$0 break; } }

However, nginx won't start and is complaining about

nginx: [emerg] unknown "0" variable

Any help would be greatly appreciated!

Comments

  • edanedan Member

    How about just this?

      location / {
        try_files $uri $uri/ /index.php?$args;
      }
  • That was the default in my Tuxlite nginx config and it didn't work.

  • if nginx
    http://wiki.nginx.org/IfIsEvil

    maybe, not sure lol

    location / {
    rewrite ^(.*)+$ /index.php?$1 last;

    }

  • charliecharlie Member, Host Rep

    try_files $uri $uri/ /index.php?/$args;

  • noosVPSnoosVPS Member
    edited August 2014

    I haven't tested this, but rewrite doc examples use $1 (and not $0) for substitution. Hence that error.

    REF: http://nginx.org/en/docs/http/converting_rewrite_rules.html

  • Why are you OPs always being "soooooooo" helpful with providing us more information? I'd really like to know for which software you need the rewrite rules for. That might help more than you think.

    Thanked by 1Profforg
  • You can always try few online tools: http://bit.ly/1qY9WdJ

  • wychwych Member

    I'd really like to know for which software you need the rewrite rules for. That might help more than you think.

    Looks like WP.

  • It is a social app built on top of codeigniter that utilizes rewrite for seo friendly images and links. I decided to just fork over some more money to get a LEB with higher ram so I can host it on apache instead to avoid this and potential problems down the road. Thank you everyone for all their help.

  • sonontse said: It is a social app built on top of codeigniter that utilizes rewrite for seo friendly images and links. I decided to just fork over some more money to get a LEB with higher ram so I can host it on apache instead to avoid this and potential problems down the road. Thank you everyone for all their help.

    NGINX might provide more scalability for this type of application. On their Wiki, they've published correct configuration files for CodeIgniter.

        location / {
                # Check if a file or directory index file exists, else route it to index.php.
                try_files $uri $uri/ /index.php;
        }
    

    I know you've switched, but for future reference NGINX is easier to configure than Apache.

    http://wiki.nginx.org/Codeigniter

Sign In or Register to comment.