apache - How to execute a PHP web page without the .php extension in the URL?
Web/WebServer 2015. 6. 8. 12:17WITHOUT FILE ENDINGS
You can make this even better by ditching the file ending altogether, so that you can visit either http://www.mywebsite.com/horses
orhttp://www.mywebsite.com/horses/
:
RewriteEngine On
RewriteRule ^horses/?$ Xu8JuefAtua.html [NC]
The ?
indicates that the preceding character is optional. So, in this case, the URL would work with or without the slash at the end. These would not be considered duplicate URLs by a search engine, but would help prevent confusion if people (or link checkers) accidentally added a slash. The stuff in brackets at the end of the rule gives Apache some further pointers. [NC]
is a flag that means that the rule is case insensitive, sohttp://www.mywebsite.com/HoRsEs
would also work.
source - http://www.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
# vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/test">
RewriteEngine on
RewriteRule ^test/?$ test.php
</Directory>
'Web > WebServer' 카테고리의 다른 글
apache - AH01630(client denied by server configuration) (0) | 2015.06.04 |
---|---|
apache - AH00035(access denied because search permissions are missing on a component of the path) (0) | 2015.06.04 |
apache - 아파치 웹 서버 모듈 추가 (0) | 2013.01.14 |
WebDAV ( Web-based Distributed Authoring and Versioning ) (0) | 2012.03.11 |
Apache - 실행환경 nobody 사용자 (0) | 2012.03.08 |