|
4/7 |
2004/9/16-17 [Computer/SW/Languages/Web, Computer/SW/Unix] UID:33570 Activity:kinda low |
9/16 Soda question: I have a file index.php in one of my public_html subdirectories, but when I http to ~me/foo/ the PHP isn't getting processed, though ~me/public_html/foo/index.php is getting served up. What am I doing wrong? \_ Do this "ln -s index.php index.html". I had to do the same thing for my index.htm. \_ Doesn't help. It loads the file but does not process it. \_ why not mv index.htm index.html \_ It was automatically generated, and I didn't want to rename it every time it's generated. \_ who was automatically generating it? \_ Photoshop. \_ Ah, I think what I'm looking for is for the line in httpd.conf #AddType application/x-httpd-php .php to be uncommented, but barring that, I can deal. -op Did a workarouns with a dummy index.html and the meta tag http-equiv="Refresh" \_ Never use meta refresh. It breaks the back button. http://www.w3.org/QA/Tips/reback \_ I just added index.php to DirectoryIndex in httpd.conf so it should work correctly now. -brett http://httpd.apache.org/docs-2.0/mod/mod_alias.html.en#redirect \_ meta refresh works client side when you can't change the server config... I don't think we have mod rewrite access on (based on quick scan of the httpd.conf) \_ on soda you can put this in your .htaccess: Redirect /~user/foo/old.html <DEAD>new.url/whatever<DEAD> Meta refresh sucks. Don't use Meta refresh. \_ Great question. index.php has just been added to DirectoryIndex. |
4/7 |
|
www.w3.org/QA/Tips/reback QA-dev Use standard redirects: don't break the back button! org/bar you should not use "refresh" techniques like : <META HTTP-EQUIV=REFRESH CONTENT="1; Imagine that the user presses the "back" button, the refresh would work again, and the user would bounce forward. The user will most likely get very annoyed, and close the window, which is probably not what you, as the author of this page, want. Use HTTP redirects instead When using the "refresh" meta-tag to create a redirection, what we have is a specific instruction within the document. The User Agent (be it a browser or the Markup Validator) is expected to download the page, look at its contents, find the "refresh" instruction, wait the specified amount of time (which could just happen to be "0" seconds for an "immediate" refresh, but really could be anything), and then proceede to the new address. A "HTTP Redirect" on the other hand acts much more directly because it is done within another layer. When the User Agent (ie a browser or the validator) first contacts the server and requests the document, the _server_ itself, having been configured to redirect the document to another address, replies to the user-agent that it should instead look at the new address. A "HTTP Redirect" is also a richer way to redirect because it gives the User Agent more information than just the new address: the server also gives some information about the purpose and type of redirection, which allows the User Agent to behave differently depending on the type of redirect. HTTP status code sent by the server) are the Permanent Redirect (HTTP 301), the Temporary Redirect (307), and the undefined redirect (302). See the links below for documentation and tutorials on how to do it with your web server. The Top Ten New Mistakes of Web Design, by Jakob Nielsen, offers a view of why refresh should not be used for redirecting a document to a new address, as well as other (do's and) don't's on web design. |
httpd.apache.org/docs-2.0/mod/mod_alias.html.en#redirect Second, the Aliases and Redirects are processed in the order they appear in the configuration files, with the first match taking precedence. For this reason, when two or more of these directives apply to the same sub-path, you must list the most specific path first in order for all the directives to have an effect. URLs with a (%-decoded) path beginning with url-path will be mapped to local files beginning with directory-path. Note that if you include a trailing / on the url-path then the server will require a trailing / in order to expand the alias. That is, if you use Alias /icons/ /usr/local/apache/icons/ then the url /icons will not be aliased. Alias, but makes use of standard regular expressions, instead of simple prefix matching. The supplied regular expression is matched against the URL-path, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a filename. Module: mod_alias The Redirect directive maps an old URL into a new one. The new URL is returned to the client which attempts to fetch it again with the new address. any requests for documents beginning with this path will be returned a redirect error to a new (%-encoded) URL beginning with URL. Note Redirect directives take precedence over Alias and ScriptAlias directives, irrespective of their ordering in the configuration file. If no status argument is given, the redirect will be "temporary" (HTTP status 302). This indicates to the client that the resource has moved temporarily. The status argument can be used to return other HTTP status codes: permanent Returns a permanent redirect status (301) indicating that the resource has moved permanently. seeother Returns a "See Other" status (303) indicating that the resource has been replaced. gone Returns a "Gone" status (410) indicating that the resource has been permanently removed. When this status is used the URL argument should be omitted. Other status codes can be returned by giving the numeric status code as the value of status. If the status is between 300 and 399, the URL argument must be present, otherwise it must be omitted. Redirect, but makes use of standard regular expressions, instead of simple prefix matching. The supplied regular expression is matched against the URL-path, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a filename. URLs with a (%-decoded) path beginning with URL-path will be mapped to scripts beginning with the second argument which is a full pathname in the local filesystem. Example: ScriptAlias /cgi-bin/ /web/cgi-bin/ A request for http://myserver/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo. ScriptAlias, but makes use of standard regular expressions, instead of simple prefix matching. The supplied regular expression is matched against the URL-path, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a filename. |