.htaccess

.htaccess - Make a directory invisible

可紊 提交于 2020-05-08 18:58:10
问题 I have a .htaccess file that currently looks like: <Files .htaccess> order allow,deny deny from all </Files> Options All -Indexes IndexIgnore * # Respond to /include/ with 404 instead of 403 RewriteEngine On RedirectMatch 404 ^/include(/?|/.*)$ I'm trying to prevent everyone from knowing that /include/ exists, however I've come across an issue. Although visiting http://www.example.com/include gives a 404, the browser adds an end slash (thus giving http://www.example.com/include/) which shows

Htaccess recursively replace underscores with hyphens

こ雲淡風輕ζ 提交于 2020-05-08 15:45:06
问题 I'm trying to redirect all URLs with underscores to the same URL but with underscores replaced by hyphens. I've tried many examples online but these either provide server errors or seem to result in a loop that crashes my server. From what I've read the following should work: RewriteRule ^([^_]*)_([^_]*_.*) $1-$2 [N] RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301] OR RewriteRule ^(.*)_(.*)$ $1-$2 [N,E=redirect:true] RewriteCond %{ENV:redirect} ^true$ RewriteRule (.*) $1 [R=301] However these

Htaccess recursively replace underscores with hyphens

假装没事ソ 提交于 2020-05-08 15:43:16
问题 I'm trying to redirect all URLs with underscores to the same URL but with underscores replaced by hyphens. I've tried many examples online but these either provide server errors or seem to result in a loop that crashes my server. From what I've read the following should work: RewriteRule ^([^_]*)_([^_]*_.*) $1-$2 [N] RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301] OR RewriteRule ^(.*)_(.*)$ $1-$2 [N,E=redirect:true] RewriteCond %{ENV:redirect} ^true$ RewriteRule (.*) $1 [R=301] However these

restrict access with htaccess in web server

十年热恋 提交于 2020-04-30 11:46:53
问题 I am using wordpress and I have a folder under wp-content/ structured as: folder |-folder1 |-file.pdf |-folder2 |-.htaccess I have all PDF files distributed within subfolders in the folder directory. I don't want all files inside the folder to be accessed directly. so I place the code in .htaccess deny from all but this does not seem to prevent that purpose. when I enter this url: http://mysite.come/wp-content/folder/folder1/file.pdf, the file still can be downloaded, which it shouldn't. what

restrict access with htaccess in web server

邮差的信 提交于 2020-04-30 11:44:08
问题 I am using wordpress and I have a folder under wp-content/ structured as: folder |-folder1 |-file.pdf |-folder2 |-.htaccess I have all PDF files distributed within subfolders in the folder directory. I don't want all files inside the folder to be accessed directly. so I place the code in .htaccess deny from all but this does not seem to prevent that purpose. when I enter this url: http://mysite.come/wp-content/folder/folder1/file.pdf, the file still can be downloaded, which it shouldn't. what

What is the “All” in Options All -Indexes in .htaccess file?

懵懂的女人 提交于 2020-04-30 07:24:41
问题 What is the "All" in Options All -Indexes in .htaccess file? Is it better than simple Options -Indexes line in .htaccess file of root folder? Thank you! 回答1: Options All means all options except MultiViews. The options list is : ExecCGI FollowSymLinks Includes IncludesNOEXEC Indexes Options All -Indexes means all options except MultiViews and Indexes for the folder. It's better to specify only the options you want for this specific folder, ie with All , your server can execute CGI scripts on

Rewrite requests to directory with htaccess to 404 error

纵饮孤独 提交于 2020-04-18 00:51:40
问题 I would like to rewrite requests to directory secret (http://example.com/secret) with .htaccess file to show always 404 Not Found error. I'm using Apache 2.4. It should work for those cases: /secret/treasure.php (all files and directories in that folder) /secret /secret/ /secret?42 /secret/?23 /secret/.php → should result in 404 Not Found /secret/.htaccess → should result in 404 Not Found My .htaccess rules block everything except the last two cases (I'm getting 403 error, but it should be

Rewrite requests to directory with htaccess to 404 error

白昼怎懂夜的黑 提交于 2020-04-18 00:49:10
问题 I would like to rewrite requests to directory secret (http://example.com/secret) with .htaccess file to show always 404 Not Found error. I'm using Apache 2.4. It should work for those cases: /secret/treasure.php (all files and directories in that folder) /secret /secret/ /secret?42 /secret/?23 /secret/.php → should result in 404 Not Found /secret/.htaccess → should result in 404 Not Found My .htaccess rules block everything except the last two cases (I'm getting 403 error, but it should be

symfony /css /images sub folder files not viewable on production

我的未来我决定 提交于 2020-04-17 22:54:56
问题 I get a 404 error when trying to access css/style.css or images/image.png in production on live server, however these work locally. I believe it maybe due to the folder location in web/css folder of project. I don't use assetic management or other apart from with js which works for /js/jsfile.js with assetic dump. Css never seemed to work for me so I previously referenced the bundle folder directly, but now just want to use /css or /images <img src="{{asset('/images/image.png')}}" I tried

Restrict access to directories through ip address

青春壹個敷衍的年華 提交于 2020-03-26 07:07:30
问题 I have a webserver with apache, say ip is 12.345.678.90 . In my www directory there are a few sites, say, site1 and site2 . Both belong to the same ip address - I created virtual hosts. Websites are on cakephp framework and there are a lots of directories, for example, app , app/tmp , lib , lib/Cake etc. When accessing the website like http://site1.com or http://site2.com everything is all right, and no way these directories can be viewed or accessed, but through ip I can see everything. http