.htaccess

Started on the old forum in April 2009 · view the original in the archive · old links redirect here

21 replies · 1,850 views · started 17 years ago · 1 min read

11 participants
brentg Developer · 95 posts #1

Hi

Is there any code i can insert into .htaccess so that i can put a small logo on all my pages instead of doing it manually on every page. Coding Talk has the small green ball.

Thanks

Free Mobile Downloads: http://playwap.mobi

Retro Newbie · 7 posts #2

Its called a favicon. download a favicon, then upload it in your web root (usually public_html, wwwroot) and it will appear like the green globe on every page.

ooooh the link I wanted too put here is censored? Search wapforum on google 🙂 SEO Bby

formerly known as Toddy 🙂

brentg Developer · 95 posts #5

Thought i will post a few .htaccess codes.

1)You have just finished a major overhaul on your site, which unfortunately meant you have renamed many pages that have already been indexed by search engines, and quite possibly linked to or bookmarked by users. You could use a redirect meta tag in the head of the old pages to bring users to the new ones, but some search engines may not follow the redirect and others frown upon it.

.htaccess leaps to the rescue!

Enter this line in your .htaccess file:

Redirect permanent /oldfile.html http://www.domain.com/filename.html

2)Require the www

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

3)Redirect everyone to different site except 1 IP address (useful for web-development)

ErrorDocument 403 http://www.someothersite.com
Order deny,allow
Deny from all
Allow from 24.33.65.6

4)Force Files to download, not be displayed in browser

AddType application/octet-stream .avi 
AddType application/octet-stream .mpg

5)Prevent Files image/file hotlinking and bandwidth stealing

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?askapache.com/.*$ [NC]
RewriteRule \.(gif|jpg|swf|flv|png)$ http://www.askapache.com/feed.gif [R=302,L]

Free Mobile Downloads: http://playwap.mobi

brentg Developer · 95 posts #7

Few More

ErrorDocuments

ErrorDocument 404 /favicon.ico
ErrorDocument 403 https://secure.htaccesselite.com
ErrorDocument 404 /cgi-bin/error.php
ErrorDocument 400 /cgi-bin/error.php
ErrorDocument 401 /cgi-bin/error.php
ErrorDocument 403 /cgi-bin/error.php
ErrorDocument 405 /cgi-bin/error.php
ErrorDocument 406 /cgi-bin/error.php
ErrorDocument 409 /cgi-bin/error.php
ErrorDocument 413 /cgi-bin/error.php
ErrorDocument 414 /cgi-bin/error.php
ErrorDocument 500 /cgi-bin/error.php
ErrorDocument 501 /cgi-bin/error.php

Require password for 1 file:

<Files login.php>
   AuthName "Prompt"
   AuthType Basic
   AuthUserFile /home/askapache.com/.htpasswd
   Require valid-user
</Files>

Protect multiple files:

<FilesMatch "^(exec|env|doit|phpinfo|w)\.*$">
   AuthName "Development"
   AuthUserFile /.htpasswd
   AuthType basic
   Require valid-user
</FilesMatch>

block access to files during certain hours of the day

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# If the hour is 16 (4 PM) Then deny all access
RewriteCond %{TIME_HOUR} ^16$
RewriteRule ^.*$ - [F,L]

I Have not tested these so if they dont work let me know 😉

Free Mobile Downloads: http://playwap.mobi

something else Fellow · 2,296 posts #10

Dj-marc wrote: My favicon isnt showing on my site. whats wrong?

favicon.ico will not show on wml unless you use favicon code but it also invalidates your wml and some people will not be able to view that page. so its best not to 🙂

something else Fellow · 2,296 posts #11

favicon will not work on valid wml It is possible to get it working but it will create errors on some browsers.

brentg Developer · 95 posts #12

anyone kno the code that stops people accessing ur dir. eg. yourdomain.com/files

Free Mobile Downloads: http://playwap.mobi

bogart Junior · 14 posts #13

brentg wrote: anyone kno the code that stops people accessing ur dir. eg. yourdomain.com/files

i also got that prob. however, theyve told me bout htaccess code, resulting to 403/4/1 error. it'll disable for files to be listed. but my prob was , i myself cant download the file, also 403 or forbidden error. lol, even i put "allow from localhost" it doesnt work.

arnage Lead · 811 posts #14
Options All -Indexes

or

<Files>
 order allow,deny
 deny from all
</Files>

If u think on some image folder, put the index.php page with

<?php
header("Location: ../"); exit();
?>
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
synergyx2009 Developer · 86 posts #15

brentg wrote: anyone kno the code that stops people accessing ur dir. eg. yourdomain.com/files

change cmod / perm to 700

|Dont forget to say thanx|

Anshul Senior · 296 posts #16

brentg wrote: anyone kno the code that stops people accessing ur dir. eg. yourdomain.com/files

<Files photos>
order allow,deny
deny from all
</Files>
friend Developer · 112 posts #17

RewriteCond %{HTTP_USER_AGENT} web.?(auto|bandit|collector|copier|devil|spoofer|downloader|fetch|hook|mole|miner|mirror|reaper|sauger|sucker|site|snake|stripper|weasel|zip) [NC,OR] # ODs RewriteCond %{HTTP_USER_AGENT} ^(My)?GetRight [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^Web.?(site.?(eXtractor¦Quester)¦Snake¦ster¦Strip¦Suck¦vac¦walk¦Whacker¦ZIP) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]

add etc.......

ori Lead · 512 posts #18

644 stops files being excuted too i did that for cgi files app.ccc etc

synergyx2009 Developer · 86 posts #19

friend wrote: RewriteCond %{HTTP_USER_AGENT} web.?(auto|bandit|collector|copier|devil|spoofer|downloader|fetch|hook|mole|miner|mirror|reaper|sauger|sucker|site|snake|stripper|weasel|zip) [NC,OR] # ODs RewriteCond %{HTTP_USER_AGENT} ^(My)?GetRight [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^Web.?(site.?(eXtractor¦Quester)¦Snake¦ster¦Strip¦Suck¦vac¦walk¦Whacker¦ZIP) [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]

add etc.......

are these codes to stop ppl from downloading your site?

|Dont forget to say thanx|

ori Lead · 512 posts #20

theres only conditions that are checking browser names in that code lol whats the result its meant to do lol

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close