|
Search:     Advanced search
Browse by category:
Glossary

Blocking direct access to scripts in your wrapper

Add comment
Votes: 0
Comments: 0
Posted: 21 Mar, 2008
by: Pope L.
Updated: 24 Mar, 2008
by: Pope L.
Sometimes we use the wrapper to bring into our Mambo site an external script. For example, on one of my sites I have a blog that is not integrated into Mambo, but by using the wrapper, the visitors to that site get to see it as if it is part of Mambo. The problem is, although the blog is wrapped, it is also sitting there on the internet under its own URL.

So, how did I stop people from going to blog.domain.com? This solution not only stops visitors from directly accessing the script, but also ensures that search engines don't list the stand-alone URL. All visitors, whether human or search engine MUST get to the blog through the wrapper link.

First, create an .htaccess file (if your script does not already have one) and place it in the root OF THE SCRIPT.
In my example, the .htaccess is in the root of the blog directory. (Note: this solution works whether your script resides in a directory or in a subdomain). Do NOT use the .htaccess in your Mambo installation - it must only be used in the directory containing the external script!.

Add this code, replacing the domain name with the domain name of the site you are adding this to:

RewriteEngine On 
RewriteBase /

# Blocking direct access
RewriteCond % !^http://www.domain.com/.*$ [NC]
RewriteCond % !^http://domain.com/.*$ [NC]
RewriteCond % ^.*index\\.php$ RewriteRule .* - [F]

That's it! Visitors can access your script with no problems, via the
wrapper link in your Mambo site, but cannot directly access the script.

Others in this Category
document How secure is Mambo?
document How to install templates on your Mambo site
document How to move your Mambo site
document How to change the template name
document Troubleshooting the WYSIWYG editor
document Lost your admin password?
document Database function failed with error 1054
document Popups not working?
document Incorrect Itemid's
document CAPTCHA not working
document Working with META tags
document Blank or 'White' Pages
document How to turn off MySQL Strict Mode
document FAQ: "This Category is currently empty"
document How to find your version of PHP & other useful information
document What to do when you get a site is temporarily unavailable error
document session save path issues
document Changing/Creating your own favicon
document FAQ: Checked In/ Checked Out
document How to use Mambo Modules
document How to determine Absolute Path

RSS