网站重定向失效求助:recruitcrm.io域名跳转异常修复方案
Hey there! Let's get that redirect issue sorted out for your site. Right now, any request to the www.recruitcrm.io domain (even ones with specific paths like /pricing) is bouncing straight to the homepage, but we need to make sure the path stays intact when stripping the www prefix. Here's how to fix this based on your server or CDN setup:
Apache (using .htaccess)
If your site runs on Apache, update your .htaccess file in the root directory of your site with these rules to handle the redirect while preserving the full request path:
RewriteEngine On # Redirect www.recruitcrm.io to recruitcrm.io, keeping the request path RewriteCond %{HTTP_HOST} ^www\.recruitcrm\.io$ [NC] RewriteRule ^(.*)$ https://recruitcrm.io/$1 [L,R=301]
Quick breakdown:
[NC]makes the host check case-insensitive (soWWW.RecruitCRM.iowill also redirect correctly)$1captures everything after the domain (like/pricingor/contact) and appends it to the non-www URLR=301sets a permanent redirect, which is best for SEO and tells browsers to remember the new URL long-term
Nginx
For Nginx servers, modify your server configuration files to add a dedicated block for the www subdomain:
# Handle www subdomain redirects server { listen 80; listen [::]:80; server_name www.recruitcrm.io; # Redirect to non-www with full path preserved return 301 https://recruitcrm.io$request_uri; } # Your main non-www server block (keep your existing config here) server { listen 80; listen [::]:80; listen 443 ssl; listen [::]:443 ssl; server_name recruitcrm.io; # Add your existing SSL, root location, and other site configs here }
Quick breakdown:
$request_uriincludes the full path and any query parameters from the original request, so/pricing?plan=prowill redirect tohttps://recruitcrm.io/pricing?plan=pro- The 301 permanent redirect ensures search engines update their indexes to the non-www URL
Cloudflare (if using CDN)
If you're using Cloudflare to manage your site, you can set up a Page Rule to handle the redirect without touching server configs:
- Go to your Cloudflare dashboard → Rules → Page Rules
- Create a new rule with:
- URL match:
www.recruitcrm.io/* - Setting: Forwarding URL → 301 Permanent Redirect
- Destination URL:
https://recruitcrm.io/$1
- URL match:
- Save the rule and wait a few minutes for changes to propagate
Quick breakdown:
- The
*in the match URL captures any path after the domain, and$1inserts that path into the destination URL, preserving your original request
Important Notes:
- Clear browser cache: Before testing, clear your browser's cache or use incognito mode—old redirects might be cached and interfere with your new setup
- SSL coverage: Make sure your SSL certificate covers both
recruitcrm.ioandwww.recruitcrm.ioto avoid security warnings during redirects - Test all cases: Verify that
https://www.recruitcrm.io,https://www.recruitcrm.io/pricing, andhttps://recruitcrm.io/pricingall behave as expected
内容的提问来源于stack exchange,提问作者Sagar Khanapurkar

