.htaccess

Document root appending in url rewriting

我怕爱的太早我们不能终老 提交于 2020-01-14 18:48:13
问题 I want to rewrite url from http://www.example.com/books/PHP/wrox to http://www.example.com/manuals/opensource/wrox I have added the following rule Options +FollowSymLinks RewriteEngine On RewriteRule ^books/PHP/(.*)$ manuals/opensource/$1 [R=301,L] The URL redirection appends my document root as http://www.example.com/home/projects/www/publications/devel/manuals/opensource/wrox My document root is /home/projects/www/publications/devel/ Thanks In advance for your help 回答1: It has to do with

Document root appending in url rewriting

一曲冷凌霜 提交于 2020-01-14 18:47:28
问题 I want to rewrite url from http://www.example.com/books/PHP/wrox to http://www.example.com/manuals/opensource/wrox I have added the following rule Options +FollowSymLinks RewriteEngine On RewriteRule ^books/PHP/(.*)$ manuals/opensource/$1 [R=301,L] The URL redirection appends my document root as http://www.example.com/home/projects/www/publications/devel/manuals/opensource/wrox My document root is /home/projects/www/publications/devel/ Thanks In advance for your help 回答1: It has to do with

Restricting access to images on a website

被刻印的时光 ゝ 提交于 2020-01-14 15:29:09
问题 I'm putting together a portfolio website which includes a number of images, some of which I don't want to be viewable by the general public. I imagine that I'll email someone a user name and password, with which they can "log-in" to view my work. I've seen various solutions to the "hide-an-image" problem on line including the following, which uses php's readfile. I've also seen another that uses .htaccess. Use php's readfile() or redirect to display a image file? I'm not crazy about the

Apache “File not found.” instead of 404. error document

倖福魔咒の 提交于 2020-01-14 14:33:08
问题 I want to set a custom 404 error document, but I have a problem with it! First, I have two RewriteRules in my .htaccess: RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ /$2/$3.php?lang=$1 [L] RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)/?$ /$2/$3/$4.php?lang=$1 [L] So my URL looks like: /de-de/page/other/stuff and opend /page/other/stuff.php?lang=de-de Now it's time to set my own error document: ErrorDocument 404 /404.php If there is a mistake in "/de-de/page/other/" for example " /de-de/wrong

How to install laravel app in subfolder of shared host?

旧城冷巷雨未停 提交于 2020-01-14 14:10:40
问题 I install laravel app in root of my shared host "public_html now I want to install Russian version of this app in ru/ subfolder but when I go to example.com/ru I got 404 Page not found error. I use apache web server my .htaccess file in root folder contain these code <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> how should i change this configuration? Thanks. 回答1: You will do it in the same way you installed it in the root directory. I will tell you

How to install laravel app in subfolder of shared host?

故事扮演 提交于 2020-01-14 14:09:19
问题 I install laravel app in root of my shared host "public_html now I want to install Russian version of this app in ru/ subfolder but when I go to example.com/ru I got 404 Page not found error. I use apache web server my .htaccess file in root folder contain these code <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> how should i change this configuration? Thanks. 回答1: You will do it in the same way you installed it in the root directory. I will tell you

.user.ini file only works 2 level of folder

微笑、不失礼 提交于 2020-01-14 13:58:09
问题 I have Apache with PHP installed (on Windows) and run as fastCGI. My php.ini has this value, upload_max_filesize = 2M. I override this value in .user.ini file to 10M. Every thing works fine until the folder level is deeper than 2 level. For example: If I put .user.ini file into www root. http://localhost/ -> ini_get('upload_max_filesize') result is 10M http://localhost/test -> ini_get('upload_max_filesize') result is 10M http://localhost/test/lv2 -> ini_get('upload_max_filesize') result is

.user.ini file only works 2 level of folder

耗尽温柔 提交于 2020-01-14 13:58:04
问题 I have Apache with PHP installed (on Windows) and run as fastCGI. My php.ini has this value, upload_max_filesize = 2M. I override this value in .user.ini file to 10M. Every thing works fine until the folder level is deeper than 2 level. For example: If I put .user.ini file into www root. http://localhost/ -> ini_get('upload_max_filesize') result is 10M http://localhost/test -> ini_get('upload_max_filesize') result is 10M http://localhost/test/lv2 -> ini_get('upload_max_filesize') result is

robots.txt htaccess block google

和自甴很熟 提交于 2020-01-14 12:39:09
问题 In my .htaccess file I have: <Files ~ "\.(tpl|txt)$"> Order deny,allow Deny from all </Files> This denies any text file from being read, but the Google search engine gives me the following error: robots.txt Status http://mysite/robots.txt 18 minutes ago 302 (Moved temporarily) How can I modify .htaccess to permit Google to read robots.txt while prohibiting everyone else from accessing text files? 回答1: Use this: <Files ~ "\.(tpl|txt)$"> Order deny,allow Deny from all SetEnvIfNoCase User-Agent

Understanding htaccess Filesmatch code

寵の児 提交于 2020-01-14 11:43:01
问题 I am trying to install drupal in a subdirectory on my bluehost hosted website... It's a HUGE pain I'm thinking the following lines from the .htaccess is the problem. When I currently navigatoe to mysite.com/subdir/install.php I get a 403 error. However, when I take out "deny" from the lines below, I cease to get that error, so I suspect that this line is causing all the trouble. My question is, can someone help me understand what is happening in the following code? Especially if you can break