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
1
vote
2 answers

apache mod_rewrite

I want mod_rewrite to do this: http://server/* -> redirect to http://server/app/* http://server/app/* should not be redirected. http://server.domain/* -> redirect to http://server/app/* http://server.domain/app* -> redirect to…
user27451
  • 1,161
  • 2
  • 11
  • 14
1
vote
1 answer

.htaccess issue php $_SERVER['PATH_INFO'] is empty

On local host I was running my php (MVC) application with following rules in my .htaccess file: Options -Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond $1…
Bipul Roy
  • 113
  • 5
1
vote
2 answers

Redirect permanent www.url.com --> www2.url.com

i have trouble to redirect (via .htaccess) an url like this: www.url.com/index.php?option=com_content&task=view&id=60&Itemid=22 to www2.url.com/something.htm I figured out that the problem is the "old" URL. A "normal" redirect…
Lars
  • 11
  • 3
1
vote
0 answers

Apache2 Location directive and mod_rewrite

I have a website that is protected with basic authentication, except for one file, one folder, and one rewritten URL location. It looks like this: AuthType Basic AuthName "Authentication Required" …
Ben Holness
  • 944
  • 2
  • 10
  • 28
1
vote
2 answers

Apache Virtual host alias: internal rewrite pages not working

I have this configuration for my site.com ServerAdmin webmaster@site.com ServerName site.com ServerAlias www.site.com DocumentRoot /websites/site.com Alias /project "/websites/site.com/project/public" …
C. Ovidiu
  • 131
  • 2
1
vote
0 answers

Apache graceful stop waiting for rewrite requests

I am using Apache as a reverse proxy, and mod_rewrite to pass on the requests to backend services for handling. I want to use Apache graceful stop, to allow in-flight requests to complete, however, it doesn't wait for rewritten requests to complete…
rhinds
  • 111
  • 3
1
vote
1 answer

How to redirect all /client pages to a different url?

i want to modify my .htaccess file such that all sites with /client path redirect to another website without changing the URL. For example: www.example.com/client/james will show: www.site2.com/james
James
  • 11
  • 1
1
vote
0 answers

Passing REQUEST_URI php-fm after a rewrite in Apache

We are trying to migrate an installation to Apache event engine replacing mod_php for PHP-FPM. We have a large an complex list of rewrites performed by apache from old urls and also to produce SEO friendly URLs as in: #Ej:…
luison
  • 282
  • 1
  • 7
  • 22
1
vote
0 answers

How can I configure a reverseproxy (at /) and a Laravel project (at /backoffice/) running in the same subdomain?

I'm trying to configure on Apache a subdomain that should: Serve a PHP Laravel app if the request starts with /backoffice ReverseProxy to a node app otherwise. I can configure the reverse proxy and the Laravel independently but not at the same…
1
vote
1 answer

Rewrite Rule from .htaccess into Apache VirtualHost

I have the following .htaccess file: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond…
Dorado
  • 113
  • 4
1
vote
1 answer

How to redirect sub.domain.com to www.domain.com/dir/page.html?

I have a old dataserver(data.example.com) which was replaced by a NAS and NAS shares are now mounted on a webserver (www.example.com). So now the oldserver is removed and i have made a "CNAME" on our DNS to point to our webserver and since our paths…
Nanoni
  • 123
  • 1
  • 6
1
vote
1 answer

How do I 301 redirect some specific URLs - including the root - to specific locations, and then everything else to the new root?

I'm struggling with a .htaccess mod_rewrite challenge. Help is appreciated. I want the following 301 redirects to work: mysite.com > https://newsite.com/subdirectory/ mysite.com/old_page_1/ >…
PhilSmully
  • 13
  • 3
1
vote
2 answers

RewriteRule (Reverse Proxy) of front page in htaccess not working

The following rule should target my front page (WordPress) to serve a different page instead. RewriteCond %{HTTP_HOST} ^example.com$ RewriteCond %{REQUEST_URI} ^($|\/$|\?|\/\?) RewriteRule ^(.*) https://yy.example.com [P] so https://example.com…
Alex Huber
  • 111
  • 1
  • 4
1
vote
2 answers

Handling both 301 redirects and internal rewriting in .htaccess

I want to do three things on my website: Redirect users with a 301 to the HTTPS version of the site when they access the HTTP version Redirect users with a 301 to the "no-www" version of the site when they put a www in the url Silently (or…
Ailothaen
  • 23
  • 4
1
vote
1 answer

use proxy or redirect to file if cookie is set and only for a subdirectory

I am currently trying to send the request either through a proxy or to a PHP file based on a cookie. The rule only apply to /api. This is what I have so far. It is part of my VirtualHost Config: RewriteEngine on # Cookie is not set. Send all request…