Jump to content

Questions regarding web design


Utherr12

Recommended Posts

1. How do I make the "default" file of a path? For example if i have the path /blogger and I access www.web-site.com/blogger it should show the main page (or default page) of that path.2. How do i make restrictions on my apache webserver? I want everyone else but me (identified by my ip) not to be able to access page X in directory Y. I know there are directives that i should put in apache.conf but i don't know how to use them.

Link to comment
Share on other sites

1. Just name your main page index.php or index.html. There are a couple of other names that will work too, but these are the most common. Browsers look for these pages when no document name is provided (ie. www.web-site.com/blogger as opposed to www.web-site.com/blogger.html)2. That's a good question. :)

Link to comment
Share on other sites

1. Just name your main page index.php or index.html. There are a couple of other names that will work too, but these are the most common. Browsers look for these pages when no document name is provided (ie. www.web-site.com/blogger as opposed to www.web-site.com/blogger.html)2. That's a good question. :)
1. I know that, but index.php doesn't work. Only .html. (and I don't want all my main pages to be named index.php or index.html)2. Can't really find .htaccess ... where the ###### is it?
Link to comment
Share on other sites

<< Topic moved to the "Web Servers" forum >>

Browsers look for these pages when no document name is provided
It's important to understand how false this statement is, in order to answer both of your questions.Both of those things are settings on the web server. The browser just sends a URL, and expects content from the server. It's the server job to determine what content to give. Both of the things you're asking for are essentially to make the server "lie" on certain conditions.Settings in the web server can be edited in either the httpd.conf file - if you have access to it; if you're on your own Windows computer, you can find it at "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf" (on XP and 32 bit versions of Vista and 7, without the "(x86)" part) - or with the creation of a file called exactly ".htaccess", placed right at the folder for which you want to apply the settings for.Once you open one of these files...1. Search for "DirectoryIndex" (or just write it if you've created an .htaccess file appropriately), and add "index.php" to the list. The order is important for folders with both files. If you add it after "index.html", directories with both "index.html" and "index.php" will have "index.html" as the directory index.2. Search for "<Directory" (or don't if you've created an .htaccess file appropriately), and once you reach one that is for the directory in which your content is, find
Allow from all

and replace it with

Allow from 127.0.0.1

To only allow yourself to view the content there.P.S. Check Tutorials and References for Web Servers for links.

Link to comment
Share on other sites

Browsers look for these pages when no document name is provided
It's important to understand how false this statement is, in order to answer both of your questions.Both of those things are settings on the web server. The browser just sends a URL, and expects content from the server. It's the server job to determine what content to give. Both of the things you're asking for are essentially to make the server "lie" on certain conditions.
Oops, yeah, I knew that. :) My bad. Good thing you're keeping an eye on me. :)
Link to comment
Share on other sites

Oops, yeah, I knew that. :) My bad. Good thing you're keeping an eye on me. :)
I'm a mod.... I keep an eye on everybody :) .
Link to comment
Share on other sites

I can't create ".htaccess" in windows because there's no file name.
Yeah, that can be a problem. Try opening a text editor or an ftp program and go to anything that would open a window that allows directory browsing of some sort. You can usually create an .htaccess in that window. e.g. I think you can use "Save As..." on a notepad file and name it .htaccess.
Link to comment
Share on other sites

I think I can do it in linux.
That works too.As far as FilesMatch goes, first I would recommend learning (perl/pc) regular expressions. edit: http://perldoc.perl.org/perlre.htmlIt will probably be one of the most useful things you'll learn since they're widely used and aren't limited to one programming language.What do you need FilesMatch to do? I can help you with the regex.
Link to comment
Share on other sites

I want to restrict access for everyone but me to a web-form i made that adds changelog revisions (file name is called rev_page.php).Or even better than this...i want the function that gets the host ip

Link to comment
Share on other sites

I want to restrict access for everyone but me to a web-form i made that adds changelog revisions (file name is called rev_page.php)
This is possible to do directly in the .php file if you're more comfortable with that:
if ($_SERVER['REMOTE_ADDR'] != 'your.address.here') {   header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');   exit('Sorry, you\'re not allowed here.');}

Also possible with a rewrite:

RewriteCond %{REQUEST_URI} ^/rev_page\.php$RewriteCond %{REMOTE_ADDR} !^your\.address\.here$RewriteRule . - [F,L]

You wouldn't necessarily need FilesMatch for this, it's possible with the Files directive:

<Files "rev_page.php">Allow from your.address.here</Files>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...