Jump to content

Whmcs sef URL Türkçe karakter problemi


Slaweally

Recommended Posts

Whmcs yeni sürümle birlikte tr karakter sorunu yaşamaya başlamıştık, bunu nginx için çözdüm ve gerekli kuralları paylaşıyorum, kendinize göre düzenleyin ve kullanın.

 

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    {{ssl_certificate_key}}
    {{ssl_certificate}}
    server_name www.orneksite.com;
    return 301 https://orneksite.com$request_uri;
}

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    {{ssl_certificate_key}}
    {{ssl_certificate}}
    server_name orneksite.com www1.orneksite.com;
    {{root}}

    charset utf-8;

    {{nginx_access_log}}
    {{nginx_error_log}}

    # Redirect directories to an address with slash
    if (-d $request_filename) {
        return 301 $uri/;
    }

    # Transliterate Türkçe karakterler içeren URL'leri ASCII karşılıklarıyla yeniden yazma
    rewrite ^/(.*)ç(.*)$ /$1c$2 permanent;
    rewrite ^/(.*)Ç(.*)$ /$1C$2 permanent;
    rewrite ^/(.*)ğ(.*)$ /$1g$2 permanent;
    rewrite ^/(.*)Ğ(.*)$ /$1G$2 permanent;
    rewrite ^/(.*)ı(.*)$ /$1i$2 permanent;
    rewrite ^/(.*)İ(.*)$ /$1I$2 permanent;
    rewrite ^/(.*)ş(.*)$ /$1s$2 permanent;
    rewrite ^/(.*)Ş(.*)$ /$1S$2 permanent;
    rewrite ^/(.*)ö(.*)$ /$1o$2 permanent;
    rewrite ^/(.*)Ö(.*)$ /$1O$2 permanent;
    rewrite ^/(.*)ü(.*)$ /$1u$2 permanent;
    rewrite ^/(.*)Ü(.*)$ /$1U$2 permanent;

    # HTTP'den HTTPS'ye yönlendirme
    if ($scheme != "https") {
        return 301 https://$host$request_uri;
    }

    location ~ /.well-known {
        auth_basic off;
        allow all;
    }

    {{settings}}

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

    location / {
        error_page 404 /index.php?$query_string;
        try_files $uri $uri/ /index.php?$query_string;
    }

    # WHMCS managed rules - Nginx uyarlaması
    # BEGIN - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ###

    # WHMCS için özel yönlendirme kuralları
    location ~ ^/(announcements|download|knowledgebase|store/ssl-certificates|store/sitelock|store/website-builder|store/order|cart/domain/renew|account/paymentmethods|password/reset|account/security|subscription|auth/provider/google_signin/finalize)/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/$1/$2 last;
    }

    # WHMCS admin panel için özel yönlendirme kuralları
    location ~ ^/AdminPanel/(addons|apps|search|domains|help/license|services|setup|utilities/system/php-compat)/?(.*)$ {
        rewrite ^/AdminPanel/(.*)$ /AdminPanel/index.php?rp=/admin/$1 last;
    }

    location ~ ^/AdminPanel/client/(.*)/paymethods/(.*)$ {
        rewrite ^/AdminPanel/client/(.*)/paymethods/(.*)$ /AdminPanel/index.php?rp=/client/$1/paymethods/$2 last;
    }

    location ~ ^/AdminPanel/setup/auth/(.*)$ {
        rewrite ^/AdminPanel/setup/auth/(.*)$ /AdminPanel/index.php?rp=/setup/auth/$1 last;
    }

    location ~ ^/AdminPanel/client/(.*)/tickets/(.*)$ {
        rewrite ^/AdminPanel/client/(.*)/tickets/(.*)$ /AdminPanel/index.php?rp=/client/$1/tickets/$2 last;
    }

    location ~ ^/AdminPanel/client/(.*)/invoice/(.*)/capture/(.*)$ {
        rewrite ^/AdminPanel/client/(.*)/invoice/(.*)/capture/(.*)$ /AdminPanel/index.php?rp=/client/$1/invoice/$2/capture/$3 last;
    }

    location ~ ^/AdminPanel/account/security/two-factor/(.*)$ {
        rewrite ^/AdminPanel/account/security/two-factor/(.*)$ /AdminPanel/index.php?rp=/admin/account/security/two-factor/$1 last;
    }

    location ~ ^/AdminPanel/search/intellisearch/(.*)$ {
        rewrite ^/AdminPanel/search/intellisearch/(.*)$ /AdminPanel/index.php?rp=/search/intellisearch/$1 last;
    }

    # END - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ###

    location ^~ /vendor/ {
        deny all;
        return 403;
    } 

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        try_files $uri =404;
        fastcgi_read_timeout 3600;
        fastcgi_send_timeout 3600;
        fastcgi_param HTTPS $fastcgi_https;
        fastcgi_pass 127.0.0.1:{{php_fpm_port}};
        fastcgi_param PHP_VALUE "{{php_settings}}";
    }

    location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ {
        add_header Access-Control-Allow-Origin "*";
        expires max;
        access_log off;
    }

    if (-f $request_filename) {
        break;
    }
}

kaynak:

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated