You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS服务器CodeIgniter网站URL重定向异常,寻求技术支持

Hey there, let's troubleshoot that stubborn redirect issue you're facing. Even after renaming the folder to 2018, accessing /audit still sends users to /audit2017—here are the key places to check, step by step:

1. Inspect your .htaccess file (most common fix)

CodeIgniter relies heavily on .htaccess for URL handling, so this is the first spot to look. Using Putty, navigate to your website's root directory (usually public_html or htdocs), then:

  • Run cat .htaccess to view the file content, or nano .htaccess to edit it directly.
  • Look for lines like:
    Redirect 301 /audit https://www.xyz.com/audit2017
    
    or
    RewriteRule ^audit$ /audit2017 [R=301,L]
    
  • Update the target path to /2018, or remove the rule entirely if you want /audit to point directly to your new folder.

2. Check your Apache/Nginx server configuration

If the .htaccess file looks clean, the redirect might be set at the server level:

  • For Apache: Check your virtual host config files (typically in /etc/httpd/conf.d/ or /etc/apache2/sites-available/). Run grep -r "audit" /etc/httpd/ to search for any redirect rules. Update any references to audit2017 to 2018, then restart Apache with sudo systemctl restart httpd.
  • For Nginx: Check your server block configs (usually in /etc/nginx/sites-available/). Run grep -r "audit" /etc/nginx/ to find relevant rules. Update the redirect target, then restart Nginx with sudo systemctl restart nginx.

3. Verify CodeIgniter's routing rules

CodeIgniter's custom routing could be forcing the redirect. Navigate to application/config/routes.php in your CodeIgniter installation:

  • Look for a line like:
    $route['audit'] = 'audit2017';
    
  • Modify it to point to your new folder/controller:
    $route['audit'] = '2018';
    
  • If there's no such rule, make sure your new 2018 folder has the correct controller structure that CodeIgniter expects.

4. Clear cache (browser and server-side)

Permanent (301) redirects get cached by browsers, so even if you fix the server side, your browser might still use the old rule:

  • Test in incognito/private browsing mode first to bypass browser cache.
  • If that works, clear your regular browser cache (Ctrl+Shift+Delete on most browsers).
  • If you're using AWS CloudFront for caching, log into the AWS Console and create a cache invalidation for /audit and /audit2017.
  • If your server uses a caching tool like Varnish, restart it with sudo systemctl restart varnish.

Double-check that there aren't any old files or symbolic links still pointing to audit2017:

  • In your website root directory, run ls -la to list all files and folders.
  • Look for a symlink named audit that points to audit2017—if found, delete it with rm audit.
  • Make sure the old audit2017 folder is fully removed if you don't need it anymore.

Give these steps a try, and one of them should fix that persistent redirect!

内容的提问来源于stack exchange,提问作者hamender yadav

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:56:25