Jump to content

Reescritura de página personalizada


Recommended Posts

We have recently worked on adding new custom pages to whmcs under the standard and criteria of the documentation.

We are needing to remove .php from some urls.
By doing some research we have found viable methods, but we faced some problems.

The simplest and most common method is to remove the extension of specific urls, this really seems very nice because it avoids possible complications with the flow of whmcs.

RewriteRule ^ company $ company.php [QSA, L]

The slightly more advanced and functional option is:

RewriteRule ^ (fileName1 | fileName2) /? $ /$1.php [L, NC]

But this method I need to comment on some lines of the default generated by whmcs and later, the login stops working. I assume probably other urls alike.

I need to achieve a mix between the rules to make the custom pages work without .php.

Any contribution you can make to me?

Full .htaccess

### BEGIN - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ###
<IfModule mod_rewrite.c>
RewriteEngine on

# RewriteBase is set to "/" so rules do not need updating if the
# installation directory is relocated.  It is imperative that
# there is also a RewriteCond rule later that can effectively get
# the actual value by comparison against the request URI.
# 
# If there are _any_ other RewriteBase directives in this file,
# the last entry will take precedence!
RewriteBase /

# Redirect directories to an address with slash
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$  $1/ [R]

# Send all remaining (routable paths) through index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


# Determine and use the actual base
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ %2index.php [QSA,L]

</IfModule>
### END - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ###

<IfModule mod_rewrite.c>
RewriteEngine on

# Custom rules
#   ### This works when I comment out the lines: 24 and 25
#   ### The problem with this method is that the login stops working and possibly other urls. 
#RewriteRule ^(empresa|hosting-barato|vps|web-hosting|dominios)/?$ /$1.php [L,NC]

#   ### This method no work
#RewriteRule ^empresa$ empresa.php [QSA,L]

</IfModule>

 

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