Most voted "htaccess" questions
WARNING: if this tag is appropriate, the question is probably duplicate. Do a search on the site before posting. Still, infrastructure configuration does not belong to the scope of the site. It was experimentally accepted a time, but it is no longer the case. The `.htaccess ` file is a configuration file for the Apache web server, allowing configuration settings to be made at a specific level of the directory, overriding the global settings.
Learn more…651 questions
Sort by count of
-
47
votes3
answers1402
viewsHow can I simplify Urls for a website?
To access a particular area of the site, I have to indicate one to three parameters in the URL: Normal URL: # aceder a um módulo http://www.meusite.com/index.php?mod=john # aceder a um sub-módulo:…
-
24
votes2
answers32776
viewsURL friendly, how to make it work with HTACCESS
I created some rules in my file .htaccess to format the display of URL, but I’m having difficulty passing the parameter to the page that shows the products and show the URL Friendly formatted, the…
-
23
votes2
answers27855
viewsWhat do Rewritecond and Rewriterule mean in a . htaccess file?
I know they are used for many purposes, either internal or external redirection, but I never understood what each one does, whenever I need something I have to resort to ready scripts because I do…
-
19
votes2
answers234
viewsHow to reference the current board
As an example, using the variable SCRIPT_FILENAME we can get the requested file, but for this problem we want to get the directory where the file is .htaccess: # Rewrite the url <IfModule…
-
18
votes1
answer1026
viewsIt is possible to use if-modified-Since with "304 not modified" without PHP
Based on this solution used in this answer in SO-en i created a . htaccess and a PHP script .htaccess: RewriteEngine On RewriteCond %{HTTP:if-modified-since} . RewriteCond %{HTTP:if-none-match} .…
-
12
votes4
answers5034
viewsSet Custom Error 403 Page
I have the following excerpt in my file .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$…
-
12
votes2
answers5258
viewsHow to redirect http to https
Well surely there must already be a question very similar to this in stackoverflow. But before they mark it as a duplicate, I have a specification that I haven’t found any "equal" question to this…
-
11
votes1
answer28571
viewsEnable . htaccess in Ubuntu
I’m using the Ubuntu system on my PC and my apache doesn’t seem to recognize htaccess, none, because I created one. htaccess to my project only that it does not interpret what is in the content. The…
-
11
votes1
answer3443
viewsUser-friendly URL using HTACCESS
I have the following link: dominio.com/?p=filmes_v&m=tt081692 Man .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^film/?$ index.php?p=filmes [NC,L] RewriteRule…
-
11
votes2
answers484
viewsHow to show custom page for inaccessible folders in Windows?
I used ErrorDocument to configure custom error pages, but when trying to access a folder that is only accessible with high privileges, instead of showing the custom page is displaying the default…
-
10
votes1
answer14408
viewsBlock direct access to files and directories
Well, my doubt is simple: How can I block direct access to files and directories on my website? For example, prevent the user from accessing the link: www.meusite.com/img and get the list of images,…
htaccessasked 8 years, 4 months ago celsomtrindade 8,038 -
9
votes1
answer774
viewsRewrite URL for "root" accesses but do not block access to sub-domains
I have the following code that rewrites the entered URL to correctly identify the areas, sub-areas and content ID the visitor is trying to access: # Rewrite the url <IfModule mod_rewrite.c>…
-
9
votes1
answer1625
views -
9
votes1
answer526
viewsAdd bar at end of URL with Htaccess
I’m having a problem with my .htaccess, because I used to use .htm at the end now that I want to bar can not change. End use .htm query string: ##### Url Dinamica ###################################…
-
9
votes2
answers742
viewsDeny/hide access to files starting with dot, like . git, . svn, . Ds_store, . yml
By default Apache denies access to files whose name begins with .ht, as an example .htaccess: <Files ~ "^\.ht"> Require all denied </Files> But I notice that many files use the prefix .,…
apache htaccess security-guard iis web.configasked 7 years, 7 months ago Guilherme Nascimento 98,651 -
8
votes1
answer10339
viewsHow does Rewritebase work on . htaccess?
I’ve always used the .htaccess for url's amigáveis no php, but recently when passing to a company X server, the . htaccess that always worked didn’t work on that server.... After researching I found…
-
8
votes2
answers2526
viewsWhat is [QSA] and similar for in Rewriterule?
I have as an example the following RewriteRule ^(Home)?/?$ page/php/Home.php [NC,L] I know that the NC is Non-Case(Não diferencia maiúsculas e minusculas). L means that if a RewriteRule is true he…
-
8
votes2
answers3308
viewsBlock direct access to a directory and create condition to free access with . htacess
I have this for when: Request is not an existing file OR Request ends with . php RewriteCond %{REQUEST_FILENAME} !-f [OR] RewriteCond %{REQUEST_FILENAME} \.php$ RewriteRule ^(.*)$…
-
8
votes1
answer6362
viewsWhat does L, R, NC mean in HTACCESS?
I don’t quite understand the way the flag works L. The doubt arose when I was trying to use the following script: #quando vier o "public" na url, reescreve para folder/public RewriteRule…
-
8
votes1
answer15493
viewsLaravel 5 - Remove public from URL
I developed a form and need to "throw it" in production server. I have no server access (Linux, Slackware). I access my application from the url…
-
8
votes2
answers635
viewsOrganize website by folders in directory
I’m venturing into my first site written in PHP and there’s one thing that bothers me, which is the way the website URL looks, for example: meusite.com/index.php?page=ucp&p=edit&id=58 The…
-
7
votes2
answers4331
viewsHow to release a protected sub-directory with . htaccess?
I have a .htaccess in my test environment developed in Cakephp and . htaccess has authentication so that no one can access it. Now I need to release a site directory, actually a Cakephp plugin, I…
-
7
votes1
answer526
views503 redirect across multiple Urls with the exception of one
How to make a 503 redirect (maintenance code) throughout the site, but leave only one URL with access? Server: Linux (Apache) with PHP 5.5 and Mysql.
-
7
votes3
answers400
viewsProblems with regular expressions (friendly url)
I’m having trouble reading the code of a particular product from a friendly URL. With the regular expression I put, it is accepting all the characters that are in front of the product code, ie…
-
7
votes1
answer569
viewsBlock redirect of extensions and folders with . htaccess
I’m trying to create a redirect with htaccess and I got it in the following way: <ifModule mod_rewrite.c> RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d…
htaccessasked 9 years, 7 months ago rafaeloliveira 419 -
6
votes2
answers2962
views.htaccess with subfolder other than root
I was working with this structure and with this htaccess: structure config/ logs/ www/ app/ bootstrap/ public/ packages/ .htaccess index.php ... vendor/ .htaccess ... htaccess <IfModule…
-
6
votes1
answer1322
viewsHow to configure . htaccess to accept a hyphen in the URL?
I’m customizing the Urls on my site, but the .htaccess does not accept hyphens Urls, for example: postagem/1/criando-efeito-fadeout-com-javascript When I write the title without the hyphens it…
-
6
votes1
answer692
viewsRedirect all pages to HTTPS except one in particular
I have the following code on .htaccses to redirect the entire site to HTTPS: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://meudominio.com/$1 [R,L] However I would like to…
-
6
votes2
answers494
viewsDirecting all root traffic to sub folder results in "403 Forbidden" error if you do not have "index.php"
The code below works perfectly to direct all website traffic transparently into the folder www: Options -Indexes +SymLinksIfOwnerMatch RewriteEngine on RewriteBase / # Verificar o destino…
-
6
votes1
answer3382
viewsdynamic friendly url
as I do for my url that and so: detalhe.php?cat=1 look like this detail/television mine .htaccess : RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule…
-
6
votes1
answer423
viewsCan denying access to a mod_rewrite folder be unsafe?
I’m thinking of creating a very limited php microframework just for own use, however I came across a situation, most frameworks uses a folder called public and on the generally production servers we…
-
6
votes1
answer103
viewshtaccess restrictions
I’d like to clean mine url so that the user does not see it,I searched on the internet but I could not make it work. I’ve already activated the bookstores in my wamp but I couldn’t make it work…
-
6
votes1
answer958
viewsHow to clear a 301 redirect that has already been stored in the browser cache?
To make it easy to understand the problem, I will call the site that had the redirect "A" and the destination "B" A 301 redirect (instead of 302) was carried out from site A to site B without any…
htaccessasked 7 years, 2 months ago Renan Cavalieri 2,748 -
6
votes1
answer754
viewsRemove file extension, not to be seen by user
How would I make the file extension not be viewed by the user? Example Once the user finishes the registration, it will be directed to the page confirmacao.php, but I would like the extension .php…
-
6
votes2
answers121
viewsRename url with database contents
How do I change the name of url with the contents of the database at PHP using the mod_rewrite? For example: I have in the bank a table with the name of urls and I want to use it as follows. Let’s…
-
5
votes1
answer1434
viewshtaccess for web.config
I switched my website to the platform Windows Azure and their server is IIS and my old one was Apache so the routes configured in htaccess are not working, need to know how to convert this:…
-
5
votes2
answers2457
views301 redirect outside the domain with htaccess
I own a domain www.dominio1.com.br that points to the root of my site and another domain www.dominio2.com.br configured as redirector to www.dominio1.com.br/novo. However, I would like the user to…
-
5
votes2
answers2206
viewsRedirect with htaccess keeping the URL
I need to redirect a registered domain (domain.com.br) to a domain folder of my hosting (domain.com/exclusive), but I want to keep the domain.com.br in the address bar, without losing the integrity…
-
5
votes1
answer2770
viewsForce Urls with www. to without www. com htaccess
I would like when typing in the URL http://www.meusite.com.br o. htaccess always redirects to http://meusite.com.br, need this 4 extra characters for advertising campaigns. The opposite with .…
-
5
votes1
answer462
viewsHow to block Image Hotlinks with warning?
A little while ago I saw a site that was displaying an image hosted on another site, at least trying.. What happens is that on the site that was linking the image of others started to appear a new…
htaccessasked 8 years, 10 months ago Junior Moreira 7,299 -
5
votes1
answer411
viewsWhat language is used in the Apache ". htaccess" file?
For example the following lines represent which language : RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)$ index.php?uri_path=$1…
-
5
votes1
answer315
viewsWhat is the difference between SCRIPT_FILENAME and REQUEST_FILENAME?
I am studying URL friendly, and in many examples I came across these two forms of writing: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d and RewriteCond %{SCRIPT_FILENAME}…
-
5
votes3
answers2116
viewsHow to rewrite a URL?
Hi, I want to rewrite a URL and I know it needs to be by .htaccess. I have this URL: www.nomedomeusite.com/visualizar?id=8 My page visualizar.php at the very beginning of body take this one id and…
htaccessasked 7 years, 9 months ago Nicolas S. 427 -
5
votes2
answers52
viewsDoubt regarding the https protocol
I am setting up an Apache server in Debian. When accessing https://.../index.php by Chrome , I have the following result: So my doubts are: To appear : I necessarily need a paid certificate, or is…
-
5
votes1
answer577
viewsHow to implement Feature Policy Header by htaccess?
For which I understood, this response header controls access to the content of the application, and in conjunction with other headers such as the Referrer Policy approached in this question,…
-
4
votes3
answers2416
viewsUse or not use bar at the end of a URL?
Whenever I will create a new website and think about the .htaccess me hit that question: force or not force the use of bar at the end of the URL. For example: http://meusite.com would be…
-
4
votes2
answers238
viewsRedirecting of HTTP requests
I have the following problem: I would like to redirect (through .htaccess) the urls below with temporary redirection (HTTP/1.1 302 Moved Temporarily) Examples: http://www.site.com.br/artigo/0/ for…
-
4
votes2
answers252
viewsInterpret and direct with URL that after domain contains a hash
I am creating a rule for interpreting addresses that after the domain begin with # followed by numbers or followed by letters whose rule should only be read if there is no file or directory matching…
-
4
votes1
answer73
viewsCache control for a specific file
If we want to implement a cache control for a particular file type, through the htaccess we can proceed as follows: <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 1…
-
4
votes1
answer1106
viewsSubfolder problem and url rewriting with Laravel
I’m trying to do the Laravel 4 run in a subdirectory, using . htaccess to rewrite the url to the public folder Example: C:\xammp\htdocs\laravel4 The .htaccess is in rewriting…