URL rewriting module for Apache web servers

learn more… | top users | synonyms (1)

0
votes
3answers
2k views

How do I make RewriteCond %{HTTP_COOKIE} match a cookie value exactly? [duplicate]

How do I make my rule match an exact value of a cookie? I've tried: RewriteCond %{HTTP_COOKIE} ^its=me$ [NC] RewriteCond %{HTTP_COOKIE} its=^me$ [NC] RewriteCond %{HTTP_COOKIE} its="me" [NC] ...
-1
votes
1answer
29 views

apache disable unconfigured subdomains [duplicate]

There is a webserver which has example.com, www.example.com, my.example.com, shop.example.com, static.example.com. All sites except www.example.com is on https. My problem is when I type ...
1
vote
0answers
18 views

RewriteBase in httpd.conf + RewriteRule in .htaccess? [duplicate]

RewriteBase is set in httpd.conf for an alias: Alias /test /home/user/test <Directory "/home/user/test"> AllowOverride All Allow from All RewriteEngine On RewriteBase /test ...
1
vote
0answers
59 views

apache mod_rewrite rules for subdomain and restful structure

I'm trying to setup several rewrite rules that allow a restful url structure to exist, but only on a certain subdomain. Several subdomains already point to the shared codebase. I also have an ...
0
votes
0answers
17 views

How should I configure my mod_rewrite rule for use in subdirectory?

I have a simple PHP site that uses the following .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/? ...
1
vote
2answers
75 views

Server-level block, deny, or redirect based on User-Agent?

We've recently begun having trouble with web-scraper/DDoS service 80legs taking down our servers a couple times per week due to their abusive crawling practices. Initially we were simply dropping in ...
1
vote
1answer
678 views

Configuring htaccess/mod_rewrite to serve static files with question mark in the URL

I've just taken on hosting of an ancient site that was converted from asp to static html, consisting of about 6,000 files. However, my server doesn't like the filenames, giving a 404 error. The URLs ...
-1
votes
1answer
55 views

Block Wildcard User-agent

how can i write rewrite condition for wildcard user agents here is the code I'm trying but doesnt work RewriteCond %{HTTP_USER_AGENT} !*uTorrent* [NC] RewriteCond %{HTTP_USER_AGENT} ...
1
vote
2answers
77 views

Can Apache be made to not send responses to specific requests?

In an effort to harden a public-facing webserver, my colleague and I came up with a plan that involves getting Apache to "Black-hole" certain requests. For instance, requests for phpmyadmin (which ...
-1
votes
1answer
52 views

Apache htaccess get subdomain and prepend it to path [duplicate]

this is my first question on ServerFault and I think I couldn't find a similar one. To the point. I would like to achieve the following using my .htaccess. subdomaina.example.com/stats/ -> ...
2
votes
1answer
110 views

Disable Apache basic auth in virtual subdirectory

I have a webserver that is completely locked down with Basic Auth <Location /> AuthType Basic # [...] rest of basic auth stuff require valid-user order deny,allow deny from ...
0
votes
1answer
132 views

How to rewrite /index.php to /app.php [duplicate]

I have this in my .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteEngine On ...
0
votes
1answer
54 views

Apache reverse proxy logic based on arbitrary header

I have apache running on a natting fw, that authenticates, reverse proxies, and provides an ssl wrapper for 2 webapps on the back end. This works with virtual hosting and proxies back based on the ...
0
votes
1answer
63 views

Apache2 mod_rewrite redirect all except one folder [duplicate]

I need to redirect the requests for my old website (www.old.com) to the new domain (www.new.com) but I would like to keep the old content available in a different folder (www.old.com/oldsite). I've ...
0
votes
1answer
71 views

convert lighttpd to nginx rewrite rules

I'm trying hard to make my code work on nginx. This configuration works with lighttpd but I want migrate it to nginx. Rewrite rules on lighttd : url.rewrite-once = ( "^/(ui)/(.*)$" => ...
0
votes
1answer
51 views

Combine chained rewrite rule to remove all trailing slashes

I'm using this rule to remove all trailing slashes: RewriteRule ^(.*)/////////$ $1 [N] RewriteRule ^(.*)////////$ $1 [N] RewriteRule ^(.*)///////$ $1 [N] RewriteRule ^(.*)//////$ $1 [N] RewriteRule ...
0
votes
1answer
93 views

Apache Adding DocumentRoot to URL when www not used - could be rewrite issue

When I visit www.mysite.com all is well. When I visit mysite.com (without the www) I get redirected to http://www.mysite.com/home/admin/domains/mysite.com/public_html which gives a 404 error. ...
0
votes
1answer
33 views

Apache rewrite rule adds 2 superflous slashes

I want to redirect all www to non-www with a google friendly 301 in apache2.2 It works basically but when I enter www.test.net in the browser I get redirected to test.net// and I would prefer without ...
0
votes
1answer
89 views

Apache: proxy an internal URL using regex

I have a few servlets listening on internal ports which are not accessible from outside. I use Apache's ProxyPass and ProxyPassReverse directives to serve them securely from port 443: ProxyPass ...
0
votes
0answers
13 views

Mod Rewrite: Add Language Prefix to Sub Directory [duplicate]

I am proxying a tumblr blog to a 3rd level deep subfolder. I am not sure if it is because of the directory path or the rewrite base, but I cannot seem to be able to remove the first blog. Instead of ...
0
votes
1answer
398 views

Apache/2.4.6 update causes 404s

I'm running a ec2 ubuntu instance, I decided to update my PHP today to 5.5.7, unfortunately it triggered apache to update as well, which has caused me many errors, the biggest one is my rewrite rules ...
0
votes
1answer
54 views

MOD_REWRITE for rewriting GET requests [duplicate]

I need a .htaccess expression to use the second get variable or get the get variable by name. Currently my mod_rewrite alters the URL to remove index.php filename and alter the pageName GET variable ...
0
votes
0answers
77 views

WORKING URL with capital letters to lowercase rule for mod_rewrite

I tried both (mod_rewrite) rules from http://www.askapache.com/htaccess/rewrite-uppercase-lowercase.html But they ain't working. http://www.example.com/de/Accessoire -> 404, it doesn't rewrite to ...
-2
votes
2answers
29 views

redirection of https page in apache [duplicate]

As it currently works. The endusers have to go the URL: https://cloud.olaf.europe.eu/owno and that works but i want the users just to go to: https://cloud.olaf.europe.eu/ to access the page. I ...
0
votes
1answer
49 views

301 permanent redirection changing URL structure [duplicate]

I changed category urls on site. Old are like this: www.example-name.com/category-name-exactly-same-keywords/ ...
0
votes
1answer
77 views

404 returned though rewrite rule is matched

I have one rewrite rule that sends all requests to index.php: RewriteRule ^.*$ index.php [NC,L] (Apart from RewriteEngine On, that's all there is in the .htaccess file) It works, unless the ...
0
votes
0answers
84 views

Mod-Rewrite - going from plain url to one with special characters

I am having a little issue with FreeBSD 10 RELEASE and Mod_Rewrite when it comes to special characters -- not in the source URL, but in the destination URL. The vast majority of Mod_Rewrites that I ...
1
vote
1answer
248 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 ...
0
votes
0answers
26 views

After migrating to Plesk 11 / Apache 2.2.15, some rewrite rules ignored [duplicate]

First, thanks in advance for any insight. We recently migrated to Plesk 11 / Apache 2.2.15. After doing so a number of our rewrite rules no longer work as expected. For example, this no longer ...
0
votes
0answers
18 views

Multiple domains one codebase [duplicate]

I'm building them a single site that has multiple languages. Originally, I was told that they wanted to site to just go to a single domain..so it would be something like this: example.com/it/home or ...
1
vote
1answer
3k views

Apache rewrite rules and special characters

I have a server where some files have an actual %20 in their name (they are generated by an automated tool which handles spaces this way, and I can't do anything about this); this is not a space: it's ...
0
votes
1answer
61 views

What can cause “Invalid command '%{HTTP_USER_AGENT}'”

While browsing my site, not even making any modifications to it, the whole thing suddenly 500's on me. Error log is full of this: Invalid command '%{HTTP_USER_AGENT}', perhaps misspelled or defined ...
3
votes
1answer
701 views

Understanding apache 2.4 mod_proxy_fcgi and RewriteRules in htaccess

We've recently switched one of our web servers to apache 2.4 and running PHP via php-fpm and mod_proxy_fcgi. Most everything works quite well, but there is one problem that I don't understand yet. One ...
5
votes
1answer
894 views

Apache 2.4 with PHP-FPM .htaccess redirection

I have Apache 2.4 set up with PHP-FPM on a server. To pass from Apache to PHP-FPM I use the following: ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9001/hosting_files/site.com/admin_secure/$1 ...
0
votes
1answer
1k views

Adventures in Drupal multisite config with mod_rewrite and clean urls

The university where I work is planning to offer Drupal hosting to staff/faculty who want a Drupal site. We've set up Drupal multisite with clean urls and it's mostly working except for some weird ...
6
votes
3answers
559 views

RewriteCond file-exists check fails for existing files

I have a weird scenario with this rewrite rule: RewriteCond img/$2/$3/$4/$1 -f RewriteRule ^img/(([a-z0-9]{4})([a-z0-9]{4})([a-z0-9]{4})[a-z0-9]{28}\.\w+)$ img/$2/$3/$4/$1 [L] The directory ...
0
votes
1answer
63 views

Apache Dynamic Virtual Host with SSL [duplicate]

I have the following in my httpd.conf file NameVirtualHost *:80 <IfModule mod_vhost_alias.c> <VirtualHost *:80> ServerAlias * UseCanonicalName Off LogFormat "%V %h %l %u %t ...
0
votes
1answer
170 views

Apache mod_proxy+mod_rewrite = “Request exceeded the limit …” error [duplicate]

Good day, I'm using Apache as a reverse proxy for my Tornado app which runs on http://localhost:8090. I want Apache to proxy everything that arrives to /api/v2 through HTTPS to http://localhost:8090. ...
0
votes
1answer
108 views

Apache Dynamic Virtual Host: RewriteMap: file for map vhost not found

Following the instructions on Apache's site I have added the following to the end of my httpd.conf file: RewriteEngine on RewriteMap lowercase int:tolower #define the map file RewriteMap vhost ...
0
votes
2answers
66 views

getting started with apache mod_rewrite on a virtual host [duplicate]

hey SO I am attempting to use apache's mod_rewrite module to do some basic rewrting of url on my website so they become a little more seo friendly basically I have a virtual host file that look ...
-4
votes
1answer
105 views

How to change .htaccess file to work right in localhost? [closed]

I have this snippet code in my .htaccess file to prevent users from hotlinking the server's images: RewriteEngine On RewriteCond %{HTTP_REFERER} ^$ [OR] RewriteCond %{HTTP_REFERER} ...
0
votes
1answer
283 views

nginx url rewrite rule

I'm doing a migration from a WordPress blog to a Jekyll Blog using NGINX as my HTTP server and I don't want to break the Internet by leaving some URL's not working as expected. I got to a point where ...
0
votes
0answers
67 views

Dynamic vhosts www alias — symlink vs mod_rewrite

MI have hundreds of domains, each of them added dynamically. Now I want each domain to have www.* alias, as far as I know there are two ways to achieve this: 1) Using symlinks www.domain.com → ...
1
vote
2answers
181 views

Virtual Host Configuration and mod_rewrite - Removing PHP Extension and Adding Forward Slash

On my production server, things are fine: PHP extension removal and trailing slash rules are in place in my .htaccess file. But locally, this isn't working (well, partially, anyway). I'm running ...
-1
votes
1answer
34 views

Apache MOD_REWRITE for subdomain

Summary I have 2 servers, 1 Production & 1 Development Problem I want to keep the servers URLS the same in the code. The production server will be blah.com but I want the development server to ...
0
votes
0answers
18 views

mod_rewrite Multilevel directories with pagination [duplicate]

I am trying to build rules for multilevel categories with pagination. Now, if there is no page input, it doesn't work. www.site.com/category/level1 www.site.com/category/level1/page=5 ...
0
votes
0answers
91 views

Apache error log not showing full path of 404 failures

If I have a working path like /gallery/landscapes and I try to access this inexistent url: /gallery/landscapes/whatever I see the 404 error in my browser but the apache log says that I had an ...
0
votes
1answer
31 views

mod_rewrite map doesn't work

I am trying to build a simple mod_rewrite map to have category names translated into ids like so: ../category/electronics -> category.php?cat=1 The map is placed inside the www folder. The code ...
1
vote
1answer
36 views

Can Apache's URL redirection send a request to both original URL and rewritten URL?

I would like to use Apache's URL redirection to match a URL and forward it's request to another URL. Simple enough, I know. But, I'd like the originally requested URL to continue to be called in ...
0
votes
0answers
85 views

How to exclude a URL from mod-rewrite with nginx?

I'm moving my Joomla! 2.5 from Apache Ubuntu to Debian nginx and I need to exclude some URLs from the mod-rewrite. Now I'm rewrite all within this directive on the IspConfig panel: # mod_rewrite url ...