| Forum: Htaccess Questions |
|---|
| Topic: Return 404's for domain no longer in use |
|---|
| Return 404's for domain no longer in use [message #1908] |
Wed, 07 July 2010 20:04 |
worm Messages: 1 Registered: July 2010 |
|
|
|
Here's my exact situation.
I used to host a website with GoDaddy for one domain (let's call it 'old.com'). I removed that domain and specified the new domain (let's call it 'new.com') that I wanted to use and put a different website there (this is NOT a 301 question).
The new domain and site works fine, but it is taking some time for the DNS servers to realize that 'old.com' should not be pointing to the webserver that 'new.com' is now using although I've updated the DNS record.
I realize this will sort itself out when the DNS records propagate.
In the mean time, I want all requests to 'old.com' to return a 404.
How would I achieve this with .htaccess?
Thanks in advance!
|
|
|
| Topic: Need help |
|---|
| Need help [message #1883] |
Tue, 22 June 2010 13:17 |
techfortune Messages: 1 Registered: June 2010 Location: India |
|
|
|
Here is my .htaccess code -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ product.php?pid=$1&rewrite=1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ product2.php?cid=$1&rewrite=1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ product3.php?bid=$1&rewrite=1&%{QUERY_STRING} [L]
Here it only execute first RewriteRule and doesn't execute other two RewriteRule's. Is there any one who can tell me what is the issue ?
Thanks in advance...
Regards,
HM
|
|
|
| Topic: is my htaccess file ok |
|---|
| is my htaccess file ok [message #1882] |
Tue, 22 June 2010 00:43 |
mikejs Messages: 1 Registered: June 2010 |
|
|
|
Hi I am trying to use mod_gzip or mod_deflate and I also want to set expired headers this is what my file looks like
is it ok have I missed somthing? thanks m
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} libwww [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)=http [NC]
RewriteRule ^(.*)$ [F,L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.saunders-solutions.net$ [NC]
RewriteRule ^(.*)$ http://www.saunders-solutions.net/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [R=301,L]
</IfModule>
# Requires mod_mime to be enabled.
<IfModule mod_mime.c>
# Send any files ending in .gz with x-gzip encoding in the header.
AddEncoding gzip .gz
</IfModule>
# Gzip compressed css files are of the type 'text/css'.
<FilesMatch "\.css\.gz$">
ForceType text/css
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine on
# Serve gzip compressed css files
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [L,QSA,T=text/css]
</IfModule>
#Create filter to match files you want to cache
<Files *.js>
Header add "Cache-Control" "max-age=604800"
</Files>
<Files *.js>
Header add "Expires" "Mon, 28 Jul 2014 23:30:00 GMT"
Header add "Cache-Control" "max-age=31536000"
</Files>
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css)$">
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
</FilesMatch>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css# Cache static content for 6 months
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/javascript A15552000
ExpiresByType text/css A15552000
|
|
|
| Topic: Remove folder from URL |
|---|
| Remove folder from URL [message #1881] |
Mon, 21 June 2010 04:23 |
wootwoot Messages: 1 Registered: June 2010 |
|
|
|
I have a site that is contained in a folder (bookmarklets) and for the last few years the URL has been:
http://marklets.com/bookmarklets
I just found out about .htaccess files and that my host supports them so I set it up so that I wouldn't need the bookmarklets folder
http://marklets.com
Here's the code:
#
Options +FollowSymlinks
RewriteEngine On
#
RewriteCond %{HTTP_HOST} marklets.com [NC]
RewriteCond %{REQUEST_URI} !bookmarklets/ [NC]
RewriteRule ^(.*)$ bookmarklets/$1 [L]
My question is, how do I remove the folder bookmarklets from ever showing up? For example, I want the url:
http://marklets.com/bookmarklets/Grooveselect.aspx
to redirect to
http://marklets.com/Grooveselect.aspx
Is that possible? I've been pulling my hair out trying to figure it out with no luck so far.
[Updated on: Mon, 21 June 2010 04:26]
|
|
|
| Topic: Problems with my code |
|---|
| Problems with my code [message #1880] |
Fri, 18 June 2010 14:23 |
Soul Reaver Messages: 1 Registered: June 2010 |
|
|
|
Hi Guys
Can you take a look at my code and tell me why the image hotlinking is not working for me please?? It is commented out at the moment by the way. As you can see I have tried two versions now and still it fails when I use a hotlink test site to try it out.
Options +FollowSymLinks
RewriteEngine on
#DISSALOWS INDEX BROWSING
Options All -Indexes
#DISSALOWS IMAGE STEALING
#RewriteCond %{HTTP_REFERER} !^http://myequinetrader.com.*$ [NC]
#RewriteCond %{HTTP_REFERER} !^http://www.myequinetrader.com.*$ [NC]
#RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.myequinetrader.com/images/ILuvMET.jpg [R,NC]
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?myequinetrader.com [NC]
#RewriteRule \.(jpg|jpeg|png|gif|bmp)$ http://www.myequinetrader.com/images/ILuvMET.jpg [NC,R,L]
#BLOCKS BAD BOTS
RewriteBase /
# IF THE UA STARTS WITH THESE
RewriteCond %{HTTP_USER_AGENT} ^(aesop_com_spiderman|alexibot|backweb|bandit|batchftp|bigfo ot) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottoug h|bullseye) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrigh tcheck) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dra gonfly) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|ema ilsiphon) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|fl unky) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit| grabnet) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks| ilsebot) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(infonavirobot|infotekies|intelliseek|interget|iria|jennybo t|jetcar) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibo t|lftp|libweb) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|m arkwatch) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(mata.?hari|memo|microsoft.?url|midown.?tool|miixpc|mirror| missigua) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(mister.?pix|moget|mozilla.?newt|nameprotect|navroad|backdo orbot|nearsite) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(net.?vampire|netants|netcraft|netmechanic|netspider|nextge nsearchbot) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(attach|nicerspro|nimblecrawler|npbot|octopus|offline.?expl orer) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(offline.?navigator|openfind|outfoxbot|pagegrabber|papa|pav uk) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebw alker) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(psbot|pump|queryn|recorder|realdownload|reaper|reget|true_ robot) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|s martdownload) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqw orm|superbot) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(superhttp|surfbot|asterias|suzuran|szukacz|takeout|telepor t) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(telesoft|the.?intraformant|thenomad|tighttwatbot|titan|url dispatcher) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(turingos|turnitinbot|urly.?warning|vacuum|vci|voideye|whac ker) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyb org|anonymouse) [NC,OR]
# STARTS WITH WEB
RewriteCond %{HTTP_USER_AGENT} ^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copie r|master|reaper|sauger|site.?quester|whack) [NC,OR]
# ANYWHERE IN UA -- GREEDY REGEX
RewriteCond %{HTTP_USER_AGENT} ^.*(craftbot|download|extract|stripper|sucker|ninja|clshttp| webspider|leacher|collector|grabber|webpictures).*$ [NC]
RewriteRule . - [F,L]
#ERROR PAGE REDIRECTS
ErrorDocument 400 http://www.myequinetrader.com/404.shtml
ErrorDocument 401 http://www.myequinetrader.com/404.shtml
ErrorDocument 403 http://www.myequinetrader.com/404.shtml
ErrorDocument 404 http://www.myequinetrader.com/404.shtml
ErrorDocument 500 http://www.myequinetrader.com/404.shtml
#REDIRECT HTTP TO WWW
RewriteCond %{HTTP_HOST} ^myequinetrader.com [NC]
RewriteRule ^(.*)$ http://www.myequinetrader.com/$1 [L,R=301]
Mark
|
|
|
| Topic: Restrict access time |
|---|
| Restrict access time [message #1877] |
Tue, 15 June 2010 21:02 |
a01020304 Messages: 1 Registered: June 2010 |
|
|
|
I am looking to restrict a specific ip address from accessing a website. They would only be allowed to view it from 7am to 6pm, is this possible using .htaccess?
if yes, anyone have the settings? as cannot find anything that relates to this.
the server is -5 hours
all other users would be allowed access at all times, its just the one ip that would be limited to specific hours
[Updated on: Tue, 15 June 2010 21:21]
|
|
|
| Topic: htaccess difficulty |
|---|
| htaccess difficulty [message #1876] |
Sun, 13 June 2010 19:30 |
mittal Messages: 1 Registered: June 2010 Location: India |
|
|
|
i have created a password for htaccess but whenever i try to login in my htaccess window then it does not let me inside.
my .htaccess file is
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/public_html/wap/images/.htpasswd
AuthGroupFile /dev/null
require valid-user
my .htpasswd is
juman:BaOVgO1.huP2c
can anybody plz tell me wat i have to enter in my username and password.
[Updated on: Sun, 13 June 2010 19:33]
|
|
|
| Topic: Rewriting for .com domain |
|---|
| Rewriting for .com domain [message #1874] |
Thu, 10 June 2010 15:40 |
jamiecottonuk Messages: 1 Registered: June 2010 |
|
|
|
Could someone please point me in the right direction.
I want to create a rewrite rule so that if a user accesses the site on www.foo.com it would request www.foo.com/foo/index.php
So basically if they come through www.foo.com all of the php pages would be forced to go through the foo php controller. However if they accessed www.foo.co.uk they wouldn't.
With the rewrite rule
www.foo.com/testpage would go to www.foo.com/foo/testpage
www.foo.com/about-us would go to www.foo.com/foo/about-us
www.foo.com/contact-us would go to www.foo.com/foo/contact-us
www.foo.co.uk/testpage would go to www.foo.co.uk/testpage
www.foo.co.uk/about-us would go to www.foo.co.uk/about-us
www.foo.co.uk/contact-us would go to www.foo.co.uk/contact-us
Of course there are more than 3 pages but the above was just to give an example. Also the url in the address bar must stay www.foo.com/testpage, www.foo.com/about-us etc not not display the middle controller
Cheers
|
|
|
| Topic: Hide URL username password |
|---|
| Hide URL username password [message #1873] |
Thu, 10 June 2010 08:27 |
nath2099 Messages: 1 Registered: June 2010 |
|
|
|
Hi,
I have a client who wishes to host their videos from my server. I have password protected a directory using htaccess and htpasswd. I can now call pages in this directory using a link from their servers:
username:password@www.site.com[/email]
I am wondering if it is possible to rewrite the url on my end to something like:
www.site.com/client/
so that the username and password is never visible in the url bar in the end users browser?
I hope this makes sense!
Thanks in advance,
Nathan.
I should add that the username and password will change every time the site is accessed.
[Updated on: Thu, 10 June 2010 08:31]
|
|
|
| Topic: Subdomain to subdomain question |
|---|
|
| Topic: htaccess primacy |
|---|
| htaccess primacy [message #1869] |
Tue, 08 June 2010 13:07 |
aliirooni Messages: 1 Registered: June 2010 |
|
|
|
hi,
i wanna set password on root of my website. but beacuse of index.php primacy than htaccess it can`t work. how can i resolve this prob?
[Updated on: Tue, 08 June 2010 13:08]
|
|
|
| Topic: Htaccess Problem |
|---|
| Htaccess Problem [message #1867] |
Fri, 04 June 2010 14:21 |
raghav Messages: 1 Registered: April 2010 Location: chennai |
|
|
|
hi
I am having a htaccess URL
1.RewriteRule ^exemples-demandes-devis-([^/\.]+)-([^/\.]+).html?$ exemples-subcat-demandes-devis.php?cate=$1&subcat=$2 [R=301]
now i am going to write the URL
2.RewriteRule ^exemples-demandes-devis-travaux-Abri_Garage.html$ exemples-demandes-devis-travaux-Abri_Pergola_Garage.html [R=301]
while i enter the URL second one
exemples-demandes-devis-travaux-Abri_Garage.html
it is redirecting to the
exemples-subcat-demandes-devis.php?cate=$1&subcat=$2 which one written globally
i have to redirect the url to the second one
Please tell me the solution it is very urgent
Thanks in Advance
|
|
|
| Topic: Joomla & Htaccess, any ideas? |
|---|
| Joomla & Htaccess, any ideas? [message #1866] |
Thu, 03 June 2010 18:38 |
eoin@uglyfashionmedia.com Messages: 1 Registered: June 2010 |
|

|
|
Hi I've got a .htaccess file but I can't get it to turn off error messages. I've posted the whole file below and the last line is what I expect to turn off the error messages.
Can anyone help me to understand why it's not working because I'm struggling at the moment.
Cheers.
Quote:##
# @version $Id: htaccess.txt 13415 2009-11-03 15:53:25Z ian $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##
#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)
# RewriteBase /
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
php_flag display_errors off
|
|
|
| Topic: htaccess is not passing %20 in address |
|---|
| htaccess is not passing %20 in address [message #1864] |
Wed, 02 June 2010 22:34 |
dodgson Messages: 1 Registered: June 2010 |
|
|
|
Hi There, I'm new to the forum. I'm having some difficulty with what I suspect is a simple problem. The following is working really well except for links that have a %20 in the original URL. Everytime I go to the new address created by the .htaccess file in my browser the %20 is changed to a 0, so I get an error page. Is there any way I can have the exact URL passed to the browser. The first rule below works perfectly, the second doesn't due to the %20.
You can see the result at pds.ca
an example of a new address would be pds.ca/Mauricie. this would send the user to the data.gointranet address.
RewriteEngine On
RewriteRule ^Mauricie http://data.gointranet.com/unitloc/pdsca/search.cgi?type=location&cu=PDS49&cl=Mauricie&term=QC&otype=region
RewriteRule ^Montreal http://data.gointranet.com/unitloc/pdsca/search.cgi?type=location&cu=PDS38&cl=Montreal%20Est&term=QC&otype=region
Thanks in advance.
Mark
[Updated on: Wed, 02 June 2010 22:38]
|
|
|
| Topic: help! htaccess file on root account is blocking subdomains |
|---|
help! htaccess file on root account is blocking subdomains [message #1860] |
Sat, 29 May 2010 06:17 |
mattc Messages: 1 Registered: May 2010 Location: zc |
|

|
|
hi all, this looked like a good place to look for some guidance. so i have a site (californiatrenchless.com (php)) and it exists on the root directory of my server.
the htaccess file for this site is also located on the root direcotry, and because of its rewrites it looks like it is basically grabbing all connections to the server (like connecting to a subdomain (pipeline-photos.californiatrenchless.com)
and trying to pass it onto the californiatrenchless site, which is obviously returning an error because that address isnt valid.
i thought the obvious solution was to move the californiatrenchless.com site to its own folder instead of letting it reside on the root directory, but per godaddy's licensing agreements i cannot change the absolute path of a domain once its been set. i can only redirect or forward.
can anyone helpe me add some lines to this htaccess file to make it more accurate. I only want it to 'do its thing' if the connection is to californiatrenchless.com. if the connection is to anything else other than californiatrenchless.com i want it to leave it alone and let it pass onto the corresponding folder.
htaccess file is attached. please gtalk me for ftp access if u would like to see the config or anything. thanks!
i put the file for download here
https://www.yousendit.com/transfer.php?action=batch_download &batch_id=dXFWK2VvNHZ5UkUwTVE9PQ
i didnt see a spot to upload on here?
|
|
|