rewritecond

Stop Mod_Rewrite execution on matching RewriteCond

I am running the free version of Helicon ISAPI Rewrite on IIS and have several sites running through the same set of rewrite rules. Up 'til now this has been fine as all the rules have applied to all the sites. I have recently added a new site which I don't want to run through all the rules. Is there any way to make requests to this site...

How to Use RewriteCond BackReferencing %N

I have the following rules in my httpd.conf RewriteEngine on RewriteBase / RewriteCond %{QUERY_STRING} password=* RewriteCond %{QUERY_STRING} bi2=(.*) RewriteCond %{REQUEST_URI} /myGet.php(.*)$ RewriteRule ^(.*)$ http://blog.myexample%1.com/$1 However, when I executed the Request URI /m...

right order of rewrite rules in an htaccess file.

hi ! I need to have : http://www.example.com/v1/my-project/ redirected to http://example.com/my-project/ so : (1) remove the www from the http_host RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] (2) remove the 'v1/' part of the request_uri RewriteCond %{REQUEST_URI} ^/v1/(...

Disabling TRACE request method on Apache/2.0.52

By default, Apache 2.0.52 will respond to any HTTP TRACE request that it receives. This is a potential security problem because it can allow certain types of XSS attacks. For details, see http://www.apacheweek.com/issues/03-01-24#news I am trying to disable TRACE requests by following the instructions shown in the page linked to above. ...

how to write a rewriteCond in .htaccess to exclude a subdir and its subdirs

Hi, I have the following problem. I have a website and a blog in a subdirectory. Both of them are php. I have a .htaccess file in the root folder and another one in the blog folder. I dont' think is relevant, but the blog script is wordpress. I added a condition in the root .htaccess to skip the requests made for the blog, rewriteCon...

mod_rewrite RewriteCond based on Last-modified? (.htaccess)

I know that we can easily base a RewriteCond on any http request header. But can we check (some of) the response headers that are going to be sent? In particular, the Last-modified one? I want to rewrite a url only when the Last-modified date is older than 30 minutes and I'm trying to avoid the overhead of delegating that check to a php...

How do I prevent access to a set of folders, but allow access to images in a subfolder of one of the folders (with .htaccess)?

Hi. In my root web folder I have a list of folders (files, modules, classes) that I'm using .htaccess to prevent access to. However, in the modules/ folder, there are modules that carry their own images, which I'd like to allow access to. How do I allow access to images in a folder under modules/, but still prevent accessing any other ...

How can I disable RewriteRule for one subcategory?

I have a .htaccess in my root of website that looks like this: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.pl [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9_-]+)\.mydomain\.pl [NC] RewriteRule ^/?$ /index.php?run=places/%1 [L,QSA] RewriteCond %{REQUEST_URI} !^/index.php$ RewriteCond %{REQUEST_URI} !^/images/ Rewrite...

RewriteCond backreference not working

If I go to http://www.example.com I want it to stay there, which is working fine. If I go to http://bar.example.com it redirects to http://www..com, which is wrong I want it to go to http://www.example.com given the backreference in the RewriteCond RewriteEngine On RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www.(exa...

Apache Mod_Rewrite Question

I have a certificate that is registered to the fully qualified domain name of a server on our intranet (webserver.domain.com). When our internal users hit this site via the fully qualified name, they go right in and aren't prompted that it's an invalid cert. If they browse to the web server via the hostname (non-fully qualified) they ...

mod_rewrite rules for all web documents

I am in need of the rewrite rules and conditions to evoke a central PHP script for every and any web document requested on my server. Just to add, I do not want the PHP script to be evoked when requests are made for CSS, JS, PNG, GIF, JPG, and other media etc. I only want the script to be called for HTM, HTML and PHP documents in the roo...

Using 'mod_rewrite' how do I force HTTPS for certain paths and HTTP for all others?

I have a PHP-Apache application using mod_rewrite for clean URLs. I am having a lot of touble getting certain pages and paths forced to HTTPS while also ensuring all others will remain as HTTP. Here is an example of what I mean: // http://www.example.com/panel/ -> Should always redirect to HTTPS // http://www.example.com/store/ -> Sho...

RewriteCond all domains white www

if i have a domain www.domain1.com and www.domain2.com on same folder, how can i get the the www.(domain.com) go to domain.com? hob sombardy can help me :) my ownd idé is RewriteCond %{HTTP_HOST} www.%{HTTP_HOST} RewriteRule (.*) http://%{HTTP_HOST}/$1 [R=301,L] but i don't know about it will work. ...

.htaccess whit multi domains problem

i have this .htaccess rule RewriteCond %{HTTP_HOST} ^domain1.com RewriteRule (.*) http://www.domain2.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} www.domain1.com RewriteRule (.*) http://www.domain2.com/$1 [R=301,L] and right now i hav this code RewriteCond %{HTTP_HOST} ^www\.(.*) RewriteRule (.*) http://%1/$1 [R=301,L] the problem is ...

.htaccess - RewriteCond problems

Hi guys, There is a problem with my .htaccess file. If I type in "website.com" it redirects me correctly to "www.website.com", but if I type in "website.com/level1/level2" it redirects me to "www.website.com/index.php/level2" and gives me a 404 error. Here is what I have in my .htacces file: Options +FollowSymLinks IndexIgnore */* Re...

With mod_rewrite can I specify a RewriteBase within a RewriteCond?

I'd like to have my .htaccess file specify a different RewriteBase depending on whether the .htaccess file is on my local machine or on a web server. This is the mod_rewrite code I tried, however, it did not work: RewriteCond %{HTTP_HOST} ^localhost:8080 RewriteBase /example/ RewriteCond %{HTTP_HOST} ^www.example.com RewriteBase / Th...

Apache Rewrite is not working with subfolders

Hey Guys, As the apache docs state: "The configuration directives found in a .htaccess file are applied to the directory in which the .htaccess file is found, and to all subdirectories thereof." Which means that a rewrite in the root .htaccess affects all other folders in the website correct? That is what I've always thought, and have ...

Htaccess Modify String then Redirect 301

Hi, I'm trying to rewrite the following into htaccess using - redirect 301 redirect "mysite.com/longname/{20 character string}" to "mysite.com/shortname/{10 character string}" basically to redirect the "longname" to "shortname" and cut the "20 character string" to the first 10 characters so when I go to mywebsite.com/longname/aaaaabb...

Trying to put an exception to RewriteRule in .htaccess

I am redirecting all requests like so: RewriteRule ^sitemap.xml$ sitemap.php?/ [QSA,L] # the line below is the one I'm having trouble with RewriteCond %{REQUEST_URI} !^market-reports$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) /index.php?section=$1 [QSA,L] All my incoming links are mea...

RewriteCond match for certain parameter values, part 2

Before I begin, let me just say that I know my question is almost identical to this one. The difference is that, while I am trying to use a RewriteCond to identify a specific parameter in the query and redirect appropriately, I do not want the query string appended to the resulting URL. Here's what I'm trying to do in my .htaccess file...