htaccess rewrite trick
  • 2008/7/18 18:22

  • kristarose

  • Just popping in

  • Posts: 28

  • Since: 2008/3/22

I'm using a simple mod rewrite piece of code in an .htaccess file to set my first page with a simple url (http://www.site.com)

The code is:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.+/
RewriteRule ^(index(.php|.html|.htm))?$ /modules/mastop_publish/ [L]

This seems to work great, and I mean great with Mastop Publish, AMS, and a few others. I'm trying to get it to work with the Content Module, which still displays the long URL.

Does anyone understand what the problem may be. It's a slight bit over my head at this point.

Thanks in advance.

Re: htaccess rewrite trick
  • 2008/7/18 21:26

  • kristarose

  • Just popping in

  • Posts: 28

  • Since: 2008/3/22


Re: htaccess rewrite trick

If you get a chance and can let me know how you resolved this would appreciate it...

Interested in what ya' said here..


Re: htaccess rewrite trick

RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf)$ http://www.yourdomain.com/nohotlinking.jpe [R,NC]
How can i hotlink protect images and in the hotlink stealer website to show not an Image like in the example i gaved more up..to display an clickable Image or an clickable link ?What i must write in there after rewrite rule?

Re: htaccess rewrite trick

any have any idea?

Re: htaccess rewrite trick
  • 2008/7/19 4:30

  • pacho

  • Quite a regular

  • Posts: 235

  • Since: 2005/6/7 2

Hi, I have this sample code for avoid hotlinking (but I have not tried )


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$|.*zip$|.*pdf$|.*rar$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !yoursite\.com [NC]
#RewriteCond %{HTTP_REFERER} !friend-site\.com [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search.php\?query=cache [NC]
RewriteRule .*\.(gif|jpg|pdf|zip|rar)$ http://your-tricky-image.jpg [R,NC]

Line with "friend-site" is to allow a partner site link your images.
Line with "google" is to allow google to show your images.
Line with "your-tricky-image.jpg" put any image (1600x1200 o more recommended ).

If you don't want to show any image you can change this to:

RewriteRule (.*) /your-code.php?param=$1

I hope this is usefull!

Re: htaccess rewrite trick

and if i put that kind of image user can click on it ?and to enter my site?!That was my question...thanks..
p.s:i`ve just tested if you put this:
RewriteRule .*\.(gif|jpg|pdf|zip|rar)$ http://yoursite.com/tricky-image.jpg [R,NC]
It will show the image but when you click on it it will not go to yoursite.com will open an new window and display the picture tricky-image more larger...
And i`ve tested with :
RewriteRule .*\.(gif|jpg|pdf|zip|rar)$ http://www.yoursite.com [R,NC]
If you put like this it will display an big X blank image and if you click open new window with an big X ...so normaly i need when it shows that big X or that image not to open an new window with that image or the big X i need to open an new window to http://www.mysite.com ....any solution for this?!
Or how to put an redirect on htacces from that trickimage.jpg when someone try to click on it to redirect it to http://www.mysite.com ?!This maybe an solution too but how to do it more exactly?!


Who's Online

223 user(s) are online (94 user(s) are browsing Support Forums)

Members: 0

Guests: 223



Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits