Jump to content

Recommended Posts

Hey

I've used the below multiple times on other sites and it works, but on WHMCS it does not, any advise on how to remove .php? So you can just navigate to /hosting instead of /hosting.php?


 

RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.php -f
  RewriteRule ^([^\.]+)/$ $1.php

  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.html -f
  RewriteRule ^([^\.]+)/$ $1.html

 

Share this post


Link to post
Share on other sites

Hello @Tom Wilson

WHMCS does not currently support removing the .php extension from files. We have however introduced friendly URLs to more and more areas of the product.

As outlined by my colleague John on our Feature Request Board

We introduced a new Friendly URLs feature which brings the potential for more human-readable URLs to different parts of the system. You can see an example of this in the MarketConnect landing pages, eg: /store/email-services.

Unfortunately I cannot provide an ETA on this and any announcements such as this will be made on our Blog or in the WHMCS Changelogs

Regards,

Stephen.

Share this post


Link to post
Share on other sites
11 hours ago, WHMCS Stephen said:

Hello @Tom Wilson

WHMCS does not currently support removing the .php extension from files. We have however introduced friendly URLs to more and more areas of the product.

As outlined by my colleague John on our Feature Request Board

We introduced a new Friendly URLs feature which brings the potential for more human-readable URLs to different parts of the system. You can see an example of this in the MarketConnect landing pages, eg: /store/email-services.

Unfortunately I cannot provide an ETA on this and any announcements such as this will be made on our Blog or in the WHMCS Changelogs

Regards,

Stephen.

Hi Stephen

it would be great if this is pushed out quicker, it just seems messy to tell customers “for more information visit www.example.com/about.php” - just to say about without the extension is a lot more corporate and friendly. 

 

Share this post


Link to post
Share on other sites

Welcome to the "community" @WHMCS Stephen wave-smiley.gif

16 hours ago, WHMCS Stephen said:

As outlined by my colleague John on our Feature Request Board

that link's pointing back to this current thread... i'm getting dizzy following the loop! 36chndelles.gif

19 hours ago, Tom Wilson said:

I've used the below multiple times on other sites and it works, but on WHMCS it does not, any advise on how to remove .php? So you can just navigate to /hosting instead of /hosting.php?

as Stephen says, Friendly URLs is the stumbling block here... I disliked answering htaccess questions before FU, but now with the feature increasingly enabled on both the admin & clients sides, I wouldn't bother trying to answer them.... it'd be like walking into a minefield without a map.

one slightly awkward workaround example, and possibly not ideal for you as it would redirect /about to about.php (and so still show the .php in the filename) would be to add a little bit of Smarty/JS to the beginning of the error/page-not-found.tpl template...

{if $currentpagelinkback|strstr:"/about"}
	<script>window.location.href = "{$systemsslurl}about.php";</script>
{elseif $currentpagelinkback|strstr:"/brian"}
	<script>window.location.href = "{$systemsslurl}brian.php";</script>
{/if}

so if you type in domain.com/whmcs/about/ it should redirect the user to domain.com/whmcs/about.php - if it works in your install (it works locally for me with minimal testing), then you could expand it with additional elseif's for other files - I wouldn't suggest trying to do this with any core WHMCS php file (e.g index, cart, clientarea etc), but it should safely work for any custom files that you've added to your install.

also, the opening slash in the strstr code above is probably essential to avoid infinite redirection loops occurring if directory and redirected filename would both match...

6 hours ago, Tom Wilson said:

it would be great if this is pushed out quicker, it just seems messy to tell customers “for more information visit www.example.com/about.php” - just to say about without the extension is a lot more corporate and friendly. 

i'd use this solution with caution... I think it will work if used correctly, but I haven't tested it thoroughly under all conditions.

Share this post


Link to post
Share on other sites
3 hours ago, brian! said:

one slightly awkward workaround example, and possibly not ideal for you as it would redirect /about to about.php (and so still show the .php in the filename) would be to add a little bit of Smarty/JS to the beginning of the error/page-not-found.tpl template... 


{if $currentpagelinkback|strstr:"/about"}
	<script>window.location.href = "{$systemsslurl}about.php";</script>
{elseif $currentpagelinkback|strstr:"/brian"}
	<script>window.location.href = "{$systemsslurl}brian.php";</script>
{/if}

It's award indeed, but it does the job! I'm going to use this. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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