Most voted "mod-rewrite" questions
This tag should be used when the question refers to some resource, information or problem related to the Apache URL Rewriting Module. Mod_rewrite is a URL rewriting module for the Apache web server. It is commonly used in URL’s called "Friendly URL’s", but also provides power and flexibility to perform various request management tasks in addition to simple replacements.
Learn more…59 questions
Sort by count of
-
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>…
-
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…
-
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…
-
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…
-
3
votes2
answers201
viewsURL rewriting in . htaccess
have the following URL: http://<site>/application/views/ambiente_teste/assets-teste/... And I wanted to rewrite it for: http://<site>/assets-teste/... I have tried in my . htaccess the…
-
3
votes1
answer859
viewsHow to use friendly Urls?
I currently use the MVC in my project and when I access my system it shows a url like this: http://localhost/view/html/cliente.html what I would like to get is: localhost/cliente because it’s the…
-
3
votes2
answers3046
viewsDots and accents in mod_rewrite Urls
I noticed that many systems that use mod_rewrite (or equivalent) usually do not support Urls with accents, usually they replace the characters as dot (dot) by hyphen (-) and accents for their…
-
3
votes1
answer538
viewsHow do I direct every request to a subfolder? (HTACCESS)
I have tried several tutorials and none worked beyond the index.php. Use the LOCALHOST and I intend that all requisition, of any kind, example: localhost:8080/teste.php…
-
3
votes1
answer211
viewsURL rewriting with "+" sign (same as Google+) . htaccess
I’d like to write a rule in . htaccess with Rewriterule using the plus sign (+) for a Google-like url, like this: meusite.com.br/+alguem be interpreted meusite.com.br/? track=someone or…
-
3
votes2
answers1909
viewsBar at the end of url with . htaccess
I need to add a bar (/) to the end of the url using . htaccess. My current . htaccess is like this: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST}…
-
3
votes1
answer1829
viewsHide domain directory using htaccess or cakephp router
I am having trouble creating a setup on . htaccess to hide a folder from my site. My domain has the following structure: www.site.com.br/cake , where are the files and folders referring to the…
-
3
votes1
answer1865
viewsRedirecting a domain to a subfolder without changing the URL, but not allowing otherwise?
I have the following problem, I have an application with the following structure: app - Folder to store project files as controllers and models. public_html - Stores public documents on the web,…
-
3
votes4
answers318
viewsHow to get the last segment of the path?
URLs de exemplo: content/edit content/edit/ content/edit?q= content/edit/?q= I tried to make the code but it always fails when the url does not have "/" or "?" and if there is "/?" at the end. The…
-
2
votes1
answer337
viewsURL Friendly by title
Good night people, I am here implementing the URL friendly system on a website and I have already working for some pages, I am now locked in the ver_establishment file that and what shows the…
-
2
votes2
answers279
views.htaccess wildcard subdomain pointing to directory + hash
Very simple to doubt. Redirect by . htaccess containing a wildcard and hash subdomain. Of: http://carros.domain.com/visualizar#123 http://casas.domain.com/visualizar#345…
-
2
votes1
answer107
viewsApache mod_rewrite
I have a rewrite rule I found in a very old question of the US: RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*/)([^/]+)/([^/]+) $1?$2=$3&%1 [L] RewriteCond %{QUERY_STRING} ^(.*)$…
-
2
votes1
answer61
viewsStarting with . htaccess
Hello; I’m trying to create friendly Urls for a site, but I’m not succeeding in several examples I’ve tried online. I think my problem is in the way I should redirect the structure of my site, I own…
-
1
votes1
answer1535
viewsHow to redirect a URL always with bar (/) at the end?
I have that code: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule . /index.php [L] </IfModule> When I type http://localhost/path I’d…
-
1
votes1
answer56
viewsHow do I modify a url with . htacess?
I have the url example.com/photo I would like to modify it for example.com/image Note I have access to . htacess and apache modules.
-
1
votes1
answer72
viewsDisregard HTTP authentication for a given URL
I have an application developed in Cakephp 2, but I believe that the issue does not have as much involvement with the framework itself, just citing to contextualize. Being this private application,…
-
1
votes1
answer112
viewsMultiple Rewriterules for 3rdparty and routes
I have a file .htaccess that adds PATH_INFO in the index.php file (for the route system): RewriteEngine On RewriteCond %(REQUEST_FILENAME) !-f RewriteCond %(REQUEST_FILENAME) !-d RewriteRule…
-
1
votes0
answers56
viewsRedirect with . htaccess
I am using the following mod-rewrite rule RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/?$ index.php?lang=$1&page=$2 [L,QSA,NC] But now I…
-
1
votes0
answers29
viewsRewrite URL in Wordpress
See if they can help me. I have a URL like this: http://www.site.com.br/portfolio-site/ilha-de-manhattan I wish she’d stay like this: http://www.site.com.br/ilha-de-manhattan Whereas manhattan…
-
1
votes0
answers45
viewsNginx Rewrite router
Good morning guys, there is some way that I can make the rules below without having to keep repeating the root folder, in this case without having to see all write "rewrite /Pw/... /Pw/... last;"…
-
1
votes1
answer86
viewsHow to create a rewrite rule to read a repository from a website subdirectory
I have two folders in my root: www/Repo-sp/ www/Repo-Rj/ My virtual host (www.meusite.local) points to www/repo-sp/: When typing /rio at the end of the site, it should point to www/repo-rj/, that is…
-
1
votes0
answers41
viewsHelp . htaccess URL’s Friendlies
Hello, I’m developing an online compiler, similar to Ideone, and would like users to be able to access some of their codes already made on the site in a simpler way. Currently I use a page…
-
1
votes1
answer58
viewsNot returning the second parameter
I am developing an api. Basically it requests a page according to the request. Example: http://localhost/mod/<name>/<version> the problem is being /version. I made htaccess that way:…
-
1
votes0
answers121
viewsError 404 when setting URL in mod_rewrite
Good I am trying to change the URL’s on my website as the example below the file. htaccess but I end up with the localhost "Object not found, Error 404" page. Here is the code for my . htaccess…
-
1
votes2
answers218
viewsI cannot capture ROUTE without using index in URL
In short, it only works if I put index.php in the URL. I think it’s in . htaccess, but I don’t know where. I wonder which configuration is incorrect or what could I do to find my error. Data:…
-
1
votes1
answer68
viewsURL with fixed and variable parameter
Hello, I’m having trouble getting my htaccess file right, and I have a fixed parameter that I pass manually and one that depends on the user when I click and change Uf, follow the example…
-
1
votes1
answer38
viewsRedirect 301 only in case of direct access to the file
I have a . zip file in a folder on my server and I don’t want direct external links to it, only through a link on my own site. So I created a . htaccess in the file folder and put: RewriteEngine on…
-
1
votes1
answer671
viewsPrevent direct access to wordpress videos (Prevent direct access files)
I own a wordpress-based Learning application, and I have several video lessons in the directory public_html/wp-content/uploads/... I would like to prevent direct access to these videos, since it is…
-
0
votes0
answers125
viewsHow can I change rewrite base using . htaccess, from my root directory to a folder?
My problem here is that I have a folder called "project" on my server, for a CMS that I use. However, when I click on a link that is in the file for example about.html, it loads a file out of the…
-
0
votes1
answer141
viewsRewriterule does not work with a specific word
It just doesn’t work for "event", but if I change to "event" it works, e.g.: Doesn’t work RewriteRule ^evento/([a-z,0-9,A-Z,_-]+)/([0-9]+)?$ evento.php?log=$1&id=$2 Works RewriteRule…
mod-rewriteasked 9 years, 11 months ago Dinho Pereira 1 -
0
votes0
answers113
viewsRedirect site with . htacess
I need to use friendly urls and am trying to make an adjustment with . htacess I have a url: http://www.site.com.br/default.asp?id=meuid&acao=minhaacao&hint=minhahint I need her to stay that…
-
0
votes1
answer95
viewsHow to map all requests to a single file?
I need to map all requests that arrive to the server as follows: exemplo.com/joao => exemplo.com/index.pl?u=joao exemplo.com/joao/ => exemplo.com/index.pl?u=joao My file /var/www/.htaccess is…
-
0
votes2
answers1247
viewsRewrite - How to redirect everything without index.php
I would like to redirect all requests from my Apache server to the test.php file and remove the index.php file from the root folder (public_html or Documentroot). I have the following code:…
-
0
votes1
answer527
viewsredirecting with mod_rewrite not working on wamp
mod_rewrite is already enabled as we can see in www.joocebox.com/? phpinfo=1 I made the change also in the archive httpd.conf as below: DocumentRoot "c:/wamp/www/" <Directory /> Order…
-
0
votes2
answers1115
viewsURL rewriting with parameter for another site . htaccess
I’d like to write a rule on .htaccess with the RewriteRule so that when someone enters the old site, be redirected to the new site keeping the requested parameter on the old site. Old site:…
-
0
votes1
answer614
viewsAccess /index.php as /index (without ".php")
Using regular expressions, I can check index.html pages as index but not index.php pages as index. My . htaccess. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond…
-
0
votes1
answer62
viewsDoubt in . htacess
Guys, I do a internship at a web development company and tals and a little while ago we had a problem in redirecting the page. In the company we used for this project Php MVC (I never got to delve…
-
0
votes0
answers21
viewsError 404 while accessing file with . htaccess
For now I’m with the following .htaccess: RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME}\.php !-d RewriteRule ^index.php\/(.*)$ pages/$1.php…
-
0
votes1
answer40
viewsHow to recover GET variables after it has been modified by . htaccess Rewriterule?
I have the following rule in . htaccess RewriteRule ^acesso-erro/(.*) proc_error.php?error=$1 [L] This rule retrieves the variables from the URL and puts in a "error". How can I recover this…
-
0
votes1
answer216
viewshtaccess does not work for wp super cache plugin
I installed the wp plugin super cache for wordpress on the server and it’s working fine. But I can’t understand why my rules on . htaccess does not work for the homepage. I rewrite the requests pro…
-
0
votes1
answer437
viewsHtaccess - Redirect all requests to a single file every time
I am trying to use a. htaccess file to redirect all requests to a single file, but I am facing some problems. My . htaccess is like this: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f…
-
0
votes0
answers40
viewsNGINX - ERR_TOO_MANY_REDIRECTS when rewriting htaccess rules
I am trying to convert some htaccess rules to NGINX and am getting ERR_TOO_MANY_REDIRECTS. The htaccess code is this https://pastebin.com/UwGnNybj Options +FollowSymLinks -MultiViews # Secuirty…
-
0
votes0
answers77
viewsHow to ignore a subdirectory that is not being represented at the current address?
Obs: The links are fictitious, but they represent my problem. I have a project done in pre-store that in the production environment, is within a subsdirectory: www.site.com/rio/index But in my…
-
0
votes1
answer43
viewsApache Rewriteengine affecting Tomcat - Ubuntu 16 server
I have the following problem. I have set up the htaccess file so that all requests are redirected to using ssl (https). So far everything worked correctly, but recently I installed Tomcat on the…
-
0
votes1
answer191
viewsmod_rewrite does not work on Ubuntu 16.04
I have a VPS with Ubuntu 16.04 but I’m not able to make it work mod_rewrite. By exhuming the command sudo a2enmod rewrite, I receive the following reply: "Module rewrite already enabled" But when I…