Apache :: How To Select Specific File With Path Using HTAccess
Jun 14, 2014I want to select a specific file by its path using .htaccess to allow access to it.
View 1 RepliesI want to select a specific file by its path using .htaccess to allow access to it.
View 1 RepliesI would like to deny access to .log
View 1 Replies View RelatedI am trying to setup a subdomain and/or virtual host to redirect to a specific port and path. I have setup my server with DDYNS through my domain name registar. Through the ddyns client I have set it to assign a subdomain of "outside.name.com" so that my server will have a easy name to get to instead of a dynamic ip address.
I have also setup on my registrars host records another subdomain of "inside.name.com" with a static IP address for internet network accessing to my server.My problem is that I have a service/program on my server that I need access to both internally and externally and this service can only be access through a port of 32400 and HTTP address of /web. (e.g. outside.name.com:32400/web or inside.name.com:32400/web)...
Is there a way that I can create a VirtualHost or Subdomain of "service.*.name.com" that redirects them to ":32400/web" of the hostname they're on? (e.g. service.outside.name.com automatically forwards or proxies--to keep it pretty--to service.outside.name.com:32400/web)
I don't know how to block a specific QUERY STRING url via .htaccess file, well actually I want to block this type of url :
test.php?q=RANDOMTEXT=&tl=The%20path%20ends
Two projects:
proj: site.loc
proj2.0: newsite.loc
They are located in different places on the file system. And i need to redirect from one project to another internally, so url for site.loc is preserved.
E.g. requesting site.loc/hey/there i need apache to serve files form proj2.0.
First, i know that on the .htaccess level we cannot use RewriteRule to file-system path (for security reasons).
Okay, an Alias is a workaround. Say I add an Alias to virtual host as following:
Code: Alias /newsite /some/path/to/proj2.0
Then if i'll add the rule to proj's .htaccess:
Code: RewriteRule ^hey/there /newsite
This will work.
But, the webroot does not work:
Code: RewriteRule ^$ /newsite
Is it i'm doing something wrong or there is some quirk about the webroot?
what is .htaccess file? use of this file?
View 6 Replies View RelatedI'd like to change /comp.php to /comp but I have only found articles on how to remove .php completely and I don't want to do that, only want to do it for this one file.
View 5 Replies View RelatedSo, I would like my htaccess file to check if a file exists and if it doesn't then redirect to another file. How would I go about doing this?
View 5 Replies View RelatedI have learned some bits of regular expressions for simple scripting, writing a .htaccess file is, uh, syntaxically daunting.
THE CASE :
The URLs of my site used to be of the form [URL] ... . They are now of the form [URL]......
I am trying to perma-redirect (301) the old format (affiche_fiche.php) to the new format (fiche.php) using a .htaccess.
So far all I have achieved is a hatred of punctuation signs. What's the correct syntax to have a .htaccess that does the redirect ?
THE CONTEXT : The format change took place more than six months ago, but the Google Webmaster Tools still spits 450 problems a day with 404s on URLs using the old format. I had assumed that these would just fade away, but they don't. So I guess that 301'ing them is cleaner. Or would be, if I understood the syntax.
I want to upload the custom 404 error page and .htaccess file to my website but .htaccess is not working on my web server. I have use the correct file name and try it many time but no result I have found. My web server is Microsoft IIS 7.5
View 2 Replies View RelatedIn my personal website at URL.... I have the top like 'index.php?pg=profile', 'index.php?pg=home' or 'index.php' (without any querystring), 'index.php?pg=diary' etc. I am looking to see if I can have .htaccess file which can make me create links like
index.php/
index.php
index.php/home
index.php/profile
index.php/diary
write an .htaccess for the same?
I was trying to set up archive-my-tweets [URL] .... and I seem to have gotten stuck with a 403 error. When I remove the .htaccess file the 403 goes away but so do the rewrite rules so that's a problem.
You'll see the contained .htaccess file that's included in the project.
Basically for now I'm just trying to run this on my mac. I have set up the files in a subdirectory of my personal web server. The personal web server is working fine--but when I go to the /tweets directory I get the 403.
I added the following to my cpanel .htaccess file on my hosting account:
<FilesMatch ".pdf$">header set x-robots-tag: noindex
</FilesMatch>
This was to stop Google from crawling and indexing my PDFs, will this work accross all my addon domains and subdomains (which are wordpress) on my hosting account or do I need to take extra measure?
I have question: How to redirect specific useragent on specific URLs to specific URLs in .htaccess [Question]
E.g.:
I want to redirect 301 with conditional:
Code:
useragent: Firefox
from my url1: domain[dot]com/old-url1/
from my url2: domain[dot]com/old-url2/
to
Code:
to new url1: in my url1: domain[dot]com/new-url1/
to new url2: in my url1: domain[dot]com/new-url2/
I create this in my .htaccess but not work
Code:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} googlebot [NC]
RewriteRule ^/?this-is-url/?$ domain[dot]com [L,R,NC]
I have a client who uses formmail on our dedicated server(another 140 clients also share this PLESK/LINUX server). While the formmail script has not been hacked, some schmuk spends the time to fill it out with spam 5-6 times a day and sends them to the client.
I verified the emails go only to the site owner and nobody else.
QUESTION: Is there a way to exclude the entire world and only allow visitors from the metro Chicago area? This would need to be done via .htaccess and not IPTABLES, as the other sites on the server draw world wide traffic.
I'm scratching my head on this, but if possible it would exclude our schmuk friend while allowing the local traffic this client draws from.
What is the path for DNS zone files located in plesk system?
View 4 Replies View Related/var/log/spam_log
Code:
Sat Apr 21 12:49:09 CEST 2007 - / - drweb x 111 10002 Dr.Web daemon account /var/drweb /sbin/nologin
Sat Apr 21 13:07:36 CEST 2007 - /home/httpd/vhosts/hollanta.nl/httpdocs/html - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 13:19:09 CEST 2007 - / - drweb x 111 10002 Dr.Web daemon account /var/drweb /sbin/nologin
Sat Apr 21 13:19:25 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 13:21:14 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 13:22:23 CEST 2007 - /home/httpd/vhosts/flevo.nl/httpdocs/myred - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 13:23:33 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 13:36:31 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 13:43:42 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 14:19:12 CEST 2007 - / - drweb x 111 10002 Dr.Web daemon account /var/drweb /sbin/nologin
Sat Apr 21 14:37:20 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 14:49:09 CEST 2007 - / - drweb x 111 10002 Dr.Web daemon account /var/drweb /sbin/nologin
Sat Apr 21 15:19:43 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Sat Apr 21 15:49:09 CEST 2007 - / - drweb x 111 10002 Dr.Web daemon account /var/drweb /sbin/nologin
Did anybody got this working including the path to the actual file?
I would like:
Code:
Sat Apr 21 15:19:43 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum/spammer.php - apache x 48 48 Apache /var/www /sbin/nologin
Rather than:
Code:
Sat Apr 21 15:19:43 CEST 2007 - /home/httpd/vhosts/brabant.nl/httpdocs/forum - apache x 48 48 Apache /var/www /sbin/nologin
Thanks in advance.
Refering to this HOWTO: [url]
application which can show me click paths for different IPs through log files,
Addition but optional requirement
An open source application it will be additional help as I will be able to add my needed features too. I am also very comfartable in PHP compare to any other language (because of all the open classes I know).
does anyone of you know a script that bans
a IP that is trying to access a specific file I can manually define?
Earlier I made a setup using UNC path in my Apache configuration. I managed to make this work. Now on another installation using Apache 2.2.22 nothing works like before.
This is how my configuration looks like ....
When accessing plesk by FTP or the panel, in the root of my domain folder I have the directory
/logs/subdomain.domain.ltd/
But only a subdomain appears, how can I do it to contain logs from another subdomain too?
There is a .htaccess~ file in the root directory of my server. .htaccess is also in that place. But what is the purpose of that .htaccess~ file?
View 3 Replies View RelatedI'm wondering why sometimes my htaccess files don't seem to work, especially when contained within subdirectories. I've got two problematic situations:
(1) I've got a mod rewrite that supposedly works. I put it in a subdirectory like /dbase/stuff/ but the script ignores it like it just isn't there. Permissions don't change anything and they are currently set to 644. It's very simple and only contains the following code: ....
I manage a high traffic website on one of my dedicated servers. It currently serves around 2 million uniques/mo.
In time, due to page changes, around 200 important URIs got a redirect [L,R=301] in the main .htaccess file that's sitting on the root directory.
Redirects are in the form of : person/J/James_Blake_2000/ --> /user/James_Blake/
Thus, the .htaccess file has reached well above 200 lines.
I would like to kindly ask for advice: should I limit the dimension of this htaccess file ?
How do you guys treat these permanent redirects?
I'm on a shared FreeBSD server, running Apache with Drupal, and vBulletin.
I had to create a local php.ini file in my public_html folder for Drupal, and another in my forum folder for vBulletin. Now my question is, what should I set the permissions of these files to? Also, what should I set .htaccess permissions to as well?
I'd like to keep them invisible to the public. But, I don't want any problems with Drupal, or vBulletin ether.
I'm used to using Linux and I know how permissions work on a desktop. I just don't know what they do when used on a server. I'm guessing 640, but I'd like to make sure before I change anything.
I'm trying to redirect from a filename that contains spaces using .htaccess
for example, I want to redirect /test 2.html to http://example.com
I've tried:
ReDirect /test 2.html http://example.com
ReDirect /test 2.html http://example.com
ReDirect /"test 2".html http://example.com
ReDirect /'test 2'.html http://example.com
ReDirect /test%202.html http://example.com
ReDirect /"test 2.html" http://example.com
ReDirect /'test 2.html' http://example.com
And a few others. I can't seem to get the syntax right, and always end up getting an internal server error message. Anyone have any ideas?
I upload a .htaccess file in FTP and it disappears, i checked with SHELL file is there but cant see in ftp ,
View 2 Replies View RelatedI am trying to set up log rotation on my Apache Server on Windows 2008 using the rotatelogs.exe executable. I believe I am having issues because my directory path has spaces.
From my understanding, a full path is needed for the ErrorLog but not for the CustomLog
ErrorLog "|"C:/Program Files (x86)/Apache Software Foundation/Apache2/bin/rotatelogs.exe" "C:/Program Files (x86)/Apache Software Foundation/Apache2/logs/Error/Error_%Y-%M-%D.log" 86400"
CustomLog "|bin/rotatelogs.exe logs/Access/Access_%Y-%M-%D.log 86400" common
The error that I get is:
C:Program Files (x86)Apache Software FoundationApache2.2bin>httpd.exe -k start
The system cannot find the path specified.
I've been developing websites using Apache on various Ubuntu laptops over the years. I just set up a new laptop with Apache and it worked fine. If I went to localhost in my browser then it showed the default page. So far, so good.
I then added a file to sites-available to add wildcard virtual hosts. This lets me use convenient urls while developing sites on my laptop. Once I enabled this site, every url that resolved to localhost became 403 Forbidden, including urls that should return 404. Here is an example entry from other_vhosts_access.log...
I am using a flash media player on one of my domains that streams music. The flash player would be like domain.com/music
The mp3 files are located in domain.com/music/mp3
The flash player just reads the title of the song and displays it in the media player.
I have used htaccess already to disable indexing, but the file name that shows on the media player is the exact name of the mp3, so I'm pretty sure people will be able to easily figure this out and start downloading our music.
What else can I add to htaccess to allow localhost access to the music, to stream with the flash player, but wont allow downloading of the mp3s.
I have download manager script that I use for my customers to download products right after the purchase.
Script generates download link that looks like this:
http://www.yourwebsite.com/download/...582921B&p=1840 (where 2YY6582921B is receipt number that is different with each purchase).
All products are placed in one folder. This folder can not be seen in above download url, but can be accessed thru browser and files can be downloaded that way without paying for them.
Can I use .htaccess and if yes how, to protect all product files the way that they can not be accessed directly by visiting url thru browser (in case somebody will find the correct url), they should be allowed for access only for my download manager script.