Jump to content

Help to remove .PHP extension from WHMCS pages using .htaccess


gr8

Recommended Posts

Hello,

 

I have a question about removing the .php extension from our WHMCS portal pages.

For example http://www.exampledomain.com/whmcs/knowledgebase.php'>http://www.exampledomain.com/whmcs/knowledgebase.php

becomes

http://www.exampledomain.com/whmcs/knowledgebase

 

I am considering this option because our frontend is using the latter URL structure i.e. http://www.exampledomain.com/domain-name/register etc.

 

We consider a uniform URL structure to be good for SEO.

 

So far we have mode_rewrite enabled on our web server and have been able to search on this forum and come across this thread which comes close but doesn't exactly solve our problem http://forum.whmcs.com/showthread.php?32310-Custom-Integration-with-SEO-Rewriting

 

1. Can someone help us modify this REGEX in order to strip the .php extension from URLs?

 

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*)$ $1.php

 

OR

RewriteRule ^knowledgebase/([0-9]+)/([^/]*)$ ./knowledgebase.php=$1 [L,NC]

RewriteRule ^knowledgebase$ ./knowledgebase [L,NC]

 

Maybe someone can suggest a better REGEX code for me to add to .htaccess....

 

2. Can someone advise on whether renaming all URLs would require me to edit hyperlinks everywhere those URLs link on the WHMCS portal (template)? A pointer in the right direction here is most welcome.

 

I hope someone who knows .htaccess server redirects will point me in the right direction here.

 

Thanks,

 

Ian

Link to comment
Share on other sites

  • 2 weeks later...
  • 9 years later...
On 9/4/2013 at 9:53 PM, JohnnyMacD said:

RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC]

RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC]

 

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{DOCUMENT_ROOT}/$1.php -f

RewriteRule ^(.*?)/?$ $1.php [L]

In this scenario, the links in the Admin panel stop working properly (( Is there an option to do the same, but only for the site template?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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