Tagged Questions

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"

learn more… | top users | synonyms (1)

0
votes
0answers
17 views

mod_rewrite not working on virtual directory

server: ubuntu 10.4 running apache2 I have a server with mod_rewrite and it works on my virtual hosts. But I am developing a new site and want to see it on the server before I change the name ...
1
vote
2answers
17 views

Rewrite rule for drupal login page, force https

I'm struggling writing a rewrite rule for a drupal login page which needs to accessed under https. RewriteRule ^/?(/user) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] so baiscally i need to ...
0
votes
1answer
35 views

convert apache rewrite to nginx

I am confused to convert this rules to nginx. RewriteEngine On RewriteCond %{REQUEST_URI} ^(.+)\~s$ RewriteRule ^(.*) stats.php?u=$1 [L] RewriteCond %{REQUEST_URI} ^(.+)\~d$ RewriteRule ^(.*) ...
1
vote
1answer
33 views

Using CloudFlare with a mirror site

I am developing a mirror website (where people can download files, sort of like a FTP). I was wondering about using CloudFlare to help cut down on bandwidth usage. I have the mirror website with ...
1
vote
1answer
14 views

Rewrite directory names to php files with htaccess?

Basically folder etc has files: contact.php help.php news.php How can I make /etc/contact direct to /etc/contact.php?
1
vote
1answer
35 views

Why is .htaccess redirecting to `default.asp` and what it is?

This is the content of my .htaccess file: Options MultiViews Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.lventas.com$ [NC] RewriteRule ^(.*)$ ...
0
votes
0answers
30 views

Remote web in localhost: htaccess redirections

I have a web working in a remote server: www.example.com and I'm copying it to my localhost, Apache is installed on port 8082 so my local adress would be localhost:8082/example.com/. This is what the ...
1
vote
1answer
49 views

mod_rewrite in .htaccess causes header not to be applied - why?

Excerpt from <VirtualHost *:80> section in httpd.conf (goal: set Cache-Control for all JavaScript files): <LocationMatch "\.js"> Header set Cache-Control "max-age=290304000, public" ...
1
vote
2answers
21 views

Access directory while mod rewrite is on

I am using the following .htaccess file to keep my URL's clean RewriteEngine On RewriteRule ^([a-zA-Z\-0-9]+)/?$ index.php?get1=$1 [B] RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ ...
0
votes
2answers
40 views

Adding apache rewrite rules to a large number of vhosts

To fix a security problem I need to add some rewrite rules to all our virtual host configurations. Are there any options adding rewrite rules to all virtual host declarations besides updating to ...
0
votes
1answer
23 views

When directory is not found add directory?

It should first check if the first /$1/ is a directory and if not add a directory before it. Examples: 1- pizza 2- pizza/olives Should rewerite the url to: 1- menu/pizza 2- menu/pizza/olives ...
1
vote
1answer
18 views

sub-subdomain wildcard redirect

Using wildcard dns / apache / mod-rewrite, I want to achieve the following: clientname.clients.company.com -> /home/company.com/clients/clientname I've tried rewrite rules, such as: RewriteEngine ...
0
votes
1answer
15 views

make apache mod_rewrite rols dynamic from db?

i have mod_rewrite rols that hard coded and i want to make it dynamic can i fatch somehow the users names from db ? or other variables i define in the config file ? ? this is what i have now : ...
0
votes
1answer
12 views

How can I create multiple VirtualHost entries that share a set or RewriteRules?

I have an apache configuration with three virtualhost entries. Each entry is bound to a different port so that we can provide a different SSL certificate based on the port. Our load balancer is ...
0
votes
1answer
24 views

Apache Rewrite not rewriting as expected

I'm trying to use mod_rewrite to redirect users to the HTTPS equivalent URL unless the URL is for my Jenkins CI server. Here is the rule I have in my default site config (my Jenkins and other sites ...
2
votes
1answer
24 views

Redirecting paths to shebang through .htaccess?

I had a small bit of code that would redirect pages accessed from my own domain to their hash addresses, like so: example.com/stationary.html => example.com/#/stationary This was the code: ...
0
votes
1answer
48 views

apache2 rewrite rule on index.php only works if index.php is typed in

RewriteRule ^index.php/(.*)$ redirect.php?s=$1 Works with website.com/index.php/something But not with website.com/something Any way to get this to work? RewriteRule ^/(.*)$ redirect.php?s=$1 ...
0
votes
1answer
18 views

.htaccess: Backreference in RewriteCond to check for file existence?

I'm trying to match URLs of this type: http://www.example.com/image/12345 I'd then like to check whether this file exists: http://www.example.com/files/image_12345.jpg If it does, I'd like to ...
3
votes
1answer
38 views

Does a RewriteCond that checks for the existence of a file cause high IO latency?

I am setting up an apache configuration to check for the existence of a file. If the file exists, then the server will redirect to a maintenance page. If not, the application will get served up ...
1
vote
1answer
18 views

How do I rewrite a URL that needs to capture both the REQUEST_URI and the HTTP_HOST?

I need to rewrite both the REQUEST_URI and the HTTP_HOST but I'm getting a redirection error when I implement this: # Capture mysite.com/pages/123 RewriteCond %{REQUEST_URI} ^/pages/[0-9]+/?$ ...
0
votes
1answer
25 views

Simple RewriteRule not working

I have the following url: http://www.mysite.com/test/index.php?topic=rules I want to rewrite it to: http://www.mysite.com/test/topic/rules I tried the following: Options +FollowSymLinks ...
1
vote
2answers
32 views

Apache2 mod_rewrite possible bug?

I have a directory named 'foo' within my virtual host root. I am trying to intercept requests for a non-existent file also called 'foo' and rewrite them to a PHP file, the .htaccess file looks like: ...
0
votes
1answer
36 views

nginx rewrite rules for cached images

we are currently migratiing all services from apache2 to nginx but are currently stuck with a specific rewrite rule. The rule in apache is checking if a cached image/thumbnail exists and if so, ...
2
votes
1answer
39 views

Apache mod_rewrite enabled but not working?

Running on Ubuntu Server 10.10 on a VPS. Running Apache2 with mod_rewrite enabled. phpinfo() shows mod_rewrite. core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic ...
1
vote
3answers
42 views

Apache mod_rewrite, multiple variables

I'm struggling a bit with mod_rewrite and replacing multiple variables with regexes. I'm trying to rewrite the following: www.mysite.com/avatars/funny/1 into: ...
0
votes
1answer
26 views

Lighttpd can not start when including mod_rewrite

Here is my server modules list (modules.conf), its working without any problems, and lighttpd is running correctly while using this list: server.modules = ( "mod_access", # "mod_alias", # ...
0
votes
1answer
24 views

Apache2 mod_rewrite eating credentials with the P flag

I have an internal server that needs to rewrite inbound requests to another internal box, for stupid reasons, both machines have basic auth enabled on them. To get around the two levels of auth, and ...
0
votes
2answers
33 views

Apache mod_rewrite for aaa.bbb.ccc.com to aaa.org

I'm trying to write my mod_rewrite rules in my .htaccess file to fix the URL that shows up in the browser bar when visitors to to my site. I have a few options that I want my users to be able to ...
0
votes
1answer
30 views

mod_rewrite rule to match first letter

I have urls structured like this http://domain.com/search.php?query=perks I want to be able to match the first letter of the query "in this case perks" and make a url like this ...
1
vote
1answer
24 views

Apache RewriteCond: inject string into URI between regex match groups

EDIT This works, needed to use % in place of $ for capture groups: RewriteRule (.*) http://localhost:8081/%1/%{TIME_YEAR}1101%2 [P] Having a hard time sorting this out. Need a date string ...
1
vote
1answer
40 views

Need to redirect all non www to www and all https to subdomain

Having trouble writing this compound rewrite containing the following rules: Requirements: Redirect all http://example.com -> http://www.example.com Redirect all https://* -> http://wwws.* Enforce ...
1
vote
1answer
39 views

apache httpd Redirecting URL based upon Server Name

We have a Jira and a Confluence system at my work. Both are running on the same servers. The actual URL to access Jira and Confluence are: http://foauslxapp05:8080/jira ...
2
votes
3answers
85 views

mod_rewrite, clean URLs, and page content directories

I am using mod_rewrite in an .htaccess file in our root web directory so that we can use cleaner URLs for some specific cases. For example, we want to translate: ...
0
votes
1answer
35 views

Apache virtual host issue with modrewrite and css files

I have an Apache virtual host for a project I have done using Silex which is based on Symfony2 however the routing works fine with the modrewrite rules but all calls to javascript or css seem to turn ...
0
votes
1answer
40 views

.htaccess RewriteRule works on addon domain but not root domain

I made a .htaccess in an addon domain, which successfully hides the wp-admin folder: # Hide wp-admin <ifModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_USER_AGENT} ...
1
vote
1answer
28 views

Mod_rewrite issue in setting up on Snow Leopard

I have come back to this as got sidelined on other things for ages. So please find my details below, with these details i get the following error still: 500 Internal Server Error The server ...
0
votes
0answers
54 views

Convert .htaccess from Apache to Nginx

i have this .htaccess configuration but I can't make it work with nginx. <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] ...
0
votes
1answer
79 views

Poor man's reverse proxy: caching using mod_rewrite

Poor man's reverse proxy: caching using mod_rewrite I am pretty sure somebody already solved this problem somehow. Long story short I want to cache GET requests to my PHP script. The script saves the ...
0
votes
1answer
23 views

mod_rewrite works when accessed internally but not externally

I'm using the following mod_rewrite rule in apache config to force all traffic through https: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} This is ...
0
votes
0answers
31 views

RewriteMap and RewriteRule troubleshooting on Apache2

First off, I'm trying to get the following rule working: RewriteMap legacyredirect txt:/var/www/path/to/legacyredirect.txt RewriteRule ...
0
votes
1answer
24 views

Rewrite a directory to / while keeping actual directory structure in tact?

My site exists www.site.com/forum I have no need for /forum but I do not want to go through the effort of changing everything. Is there a way I can get Apache to rewrite the URL so that it uses the ...
0
votes
1answer
82 views

apache virtualhost: Auto subdomain with exception

I've been searching for a way to automatically redirect domains to a specific folder, and fond a good answer here on serverfault: Apache2 VirtualHost auto subdomain. (The accepted answer) So far ...
0
votes
3answers
61 views

How to make subdirectory the document root of a web domain or localhost

I have a subdirectory abc in the document root /var/www/html I want to be able to run any file any_file.html within the subdirectory by typing in the browser: localhost/any_file instead of ...
0
votes
1answer
39 views

mod_rewrite replace character

I know this should be the easiest thing in the world, but I just can't get my head around rewriting and I have to do it so infrequently that I end up trawling Google for hours.... I'm consolidating ...
1
vote
2answers
66 views

.htaccess https redirect best method

I have searched through all the redirects posted buy others and cant quite find the answer to my problem. I have a website with over 3000 pages and we are getting duplication issues within google. ...
0
votes
1answer
75 views

Combining URL mapping and Access-Control-Allow-Origin: *

I am in the progress of migrating an old banner system to a new one and in doing so I want to rewrite the old banner system's URL's to the new one. I load my banners via an AJAX request, and therefore ...
1
vote
1answer
37 views

rewrite rule changed the base path of the web app

I have a simple web app and I set it up to use .htaccess for rewrite rules. Options +followSymlinks RewriteEngine on Rewriterule ^records/view/([0-9]+)$ ./record_view.php?id=$1 [NC] It works but ...
4
votes
1answer
163 views

how to rewrite '%25' in url

My website software replaces space characters with '+' characters in the URL, A proper link would look like 'http://www.schirmacher.de/display/INFO/How+to+reattach+a+disk+to+XenServer' for example. ...
0
votes
0answers
109 views

Apply SetEnvIf after Apache RewriteRule

I have a working apache rewrite rule: RewriteCond %{HTTP_HOST} ^.*foo.com RewriteRule (.*) http://bar.com$1 [R=301,QSA,L] and some working dontlog SetEnvIfs: SetEnvIf Host "allrecallsapp.com" ...
0
votes
0answers
134 views

Mod_rewrite with UTF-8 accent, multiviews , .htaccess

Problem: with Mod_rewrite, multiview & Apache config Introduction: The website is in french and i had problem with unicode encoding and mod_rewrite within php wihtout multiviews Old server was ...

1 2 3 4 5 18