Questions tagged [mod-rewrite]

mod_rewrite is an Apache module that allows for server-side manipulation of requested URLs.

For an introduction and examples of using mod_rewrite, read over the comprehensive article,
"Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask"

2224 questions
0
votes
1 answer

How to Handle Routes of Two Laravel Projects on One Domain or Server?

I'm working on a project divided into two separate parts. Part one, the bigger part, is in Laravel 4.2. Part two, the shorter part, is in Laravel 5. Both are on the same server. My goal is to access and use the routes of the both projects i.e…
Khuram
  • 101
  • 2
  • 11
0
votes
1 answer

htaccess - insert php script name into all URLs

I have an application which requires an htaccess file in the directory /tileserver/ that contains the following: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(tileserver\.php) RewriteRule ^(.*)$…
mheavers
  • 127
  • 7
0
votes
1 answer

Correct way to block a site if a cookie isn't present apache 2.4

I'm using apache 2.4.12 (Ubunutu 15.10) as an oauth2 proxy behind a node app. The app sends lots of unauthenticated requests before login b/c it doesn't know it's not authenticated (it doesn't know/care about the proxy) which creates lots of large…
Trimbee
  • 53
  • 1
  • 8
0
votes
1 answer

How to exclude a domain from redirection in Apache2

I have a blanket redirect setup on the server like this: RewriteEngine On #redirect all port 80 traffic to 443 RewriteCond %{HTTPS} off RewriteRule (.*)…
RandomWhiteTrash
  • 269
  • 1
  • 3
  • 17
0
votes
1 answer

Apache Domain Redirect & Rewrite Query String

My Apache server will be receiving incoming requests from users in this format: http://192.168.1.182/SEARCH=searchstring&URL=http://test.com/blahblahblah I want to redirect users to another domain, but keep the searchstring and add that at the end…
0
votes
1 answer

mod_rewrite not working for apache alias

I have created a documentation wiki that i want to attach to my main site using an Alias for the virtual host. This allows me to access the wiki by going to website.com/documentation. I have successfully used mod_rewrite in the past for an alias,…
Dan Hastings
  • 706
  • 1
  • 13
  • 24
0
votes
1 answer

move mod_rewrite content from .htaccess to apache2.conf

After moving this mod_rewrite code from .htaccess in the directory to apache2.conf its no longer working RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php…
clarkk
  • 2,035
  • 8
  • 24
  • 36
0
votes
1 answer

ModRewrite and folder with timestamp

I'm trying to forbid users access to a certain folder that has the current date in the folder name. This does not work: RewriteCond %{REQUEST_URI} ^/folder%{TIME_YEAR}%{TIME_MON}%{TIME_DAY} RewriteRule .* - [F] This does (considering today is…
Larcho
  • 101
  • 1
0
votes
1 answer

IE not interpreting mod_rewrite rule

I have a really simple mod_rewrite rule: RewriteEngine On RewriteBase / RewriteRule ^test$ hello/ [R] In Chrome, when I go to www.foobar.com/test, I get redirected to www.foobar.com/hello/, but in…
ChrisW
  • 101
  • 4
0
votes
1 answer

How do I prevent RewriteRules conflicting

I have three RewriteRules I am trying to implement but I cannot get all 3 to work together: RewriteRule ^products$ http://%{SERVER_NAME}/en_ca/products [L,R=301] RewriteRule ^products/(.*)$ http://%{SERVER_NAME}/en_ca/$1 [L,R=301] RewriteRule…
Rob Fyffe
  • 103
  • 1
0
votes
2 answers

How to force the use of SSL for some URL of my Django Application?

I want to be sure that for some URL of my website, SSL will be use. I saw a lot of answer already on SO. https://stackoverflow.com/questions/724968/force-redirect-to-ssl-for-all-pages-apart-from-one So I think I will use mod_rewrite. My question is…
Natim
  • 626
  • 1
  • 6
  • 16
0
votes
1 answer

Apache Mod Rewrite - exclude folder and subfolders, except for one subfolder

I have a Mod_Rewrite setup as follows: RewriteCond %{REQUEST_FILENAME} !^/www/live/site.name/app/public/(/forms/|/crm/) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php…
steve
  • 153
  • 1
  • 1
  • 9
0
votes
2 answers

Apache Mod Rewrite direct delevering content

i would like to know if it is possible to send a 200 status with a page content without passing by a status 30x ? exemple or rewrite condition: RewriteCond %{HTTP_USER_AGENT} ^-?$ RewriteCond %{REQUEST_URI} !errors\/noua\.htm RewriteRule (.*)…
Froggiz
  • 3,043
  • 1
  • 19
  • 30
0
votes
0 answers

mod_rewrite hide URL params

I have the following URL: www.mydomain.com/musician.php?musician=musicianname&id=idnumber I am using mod_rewrite to achieve this: www.mydomain.com/musician/musicianname/idnumber This is the rule I am using: RewriteRule…
0
votes
1 answer

Sanity Checking mod_rewrite for Apache 2.2 on Ubuntu 12.04

Summary: I'm testing a simple catch-all rewrite rule. It doesn't seem to be taking effect, it's not being logged and I'm not getting any errors. I'm a junior server administrator trying to gain a better understanding of how to configure the Apache…
igal
  • 144
  • 1
  • 10