简体   繁体   中英

301 redirects on WHMCS

I have installed WHMCS in a subdirectory, domain.com/whmcs

Now I am moving it into the main domain and I will be using custom pages. However, i don't want to have .PHP extension on the custom pages that I created. Ex. domain.com/page.php

I will need to remove .PHP extensions from specific pages and redirect these pages to non .PHP versions.

I just want to double check if this is the right 301 redirect for the search engines, before i publish it:

RewriteEngine on
RewriteRule ^mypage$ mypage.php [L]
Redirect 301 /mypage.php https: //domain.com/mypage

It works perfectly when i type domain.com/mypage.php redirects to domain.com/mypage But i am not sure if it's the right way to do it for the search engines. Currently i use wordpress in the root domain, so basically, I want to match the same links.

Thanks!

Just use this to redirect xyz.php to xyz :

Redirect 301 /xyz.php /xyz

As far as I know about search engines, its better to use a 302 redirect to avoid a ' permanent ' issue.

Make sure that /xyz actually shows a valid page. So that you do not mess up with the search engines due to a simple mistake like that.

In your example, you use both mod_rewrite and mod_alias . One of them is enough.

  • RewriteCond , RewriteRule ... are from mod_rewrite
  • Redirect , RedirectMatch ... are from mod_alias

Always, test it once before working on a production server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM