mod-rewrite

modrewrite for css / jss minified

I have a web site hosted in a CentOS 5-Plesk-Apache server. I have recently added a second site to the server for serve dynamic content. I have established rewrite rules for images (static content) that works pretty well. The module rewrites the URI in the static server to pointing to the the original file. The problem is that the first...

Is there a way to find out if a server supports mod_rewrite & .htcaccess

Is there a way to find out if a server supports mod_rewrite & .htcaccess ...

Simplest way to inject google anayltics tags into arbitrary pages?

I have a directory full of hundreds, if not thousands, of html and PHP files that I'm hosting for a client. They currently include no google analytics tracking tags, but we'd like to add them -- ideally without actually modifying the files themselves. What's the best way to do this? I'd imagine I'd want to redirect all requests for *....

mod_rewrite to redirect /index.whatever to / isn't working

I want to redirect all requests for index.html|php|php5 to http://www.domain.co.uk/ using mod_rewrite and I've copied the code from a book on search engine optimization with PHP verbatim, then added in the php5 option, but it isn't working. This is my complete .htaccess file: RewriteEngine On #translate any .html ending into .php5 Rewr...

mod_rewrite Redirect Rule Variables question

I'm a bit of an .htaccess n00b, and can't for the life of me get a handle of regular expressions. I have the following piece of RewriteRule code that works just fine: RewriteRule ^logo/?$ /pages/logo.html Basically, it takes /pages/logo.html and makes it /logo. Is there a way for me to generalize that code with variables, so that it...

complex rewrite rule needed for .htaccess file

I have a lot of simpler rules working on this site so I know mod_rewrite is working. I just can't figure out how to create a rule for this situation. I'm using Joomla CMS and one component in particular is generating awful URLs that duplicate other (pretty) URLs on the site. There is a consistent pattern so I can rewrite the URLs but thi...

Using .htaccess and mod_rewrite in a directory (not root)

I have a site that sits in a directory on a domain: http://www.example.com/site/ I also have an .htaccess file in /site/ which has several rewrite rules. These rules work if all the files (including the .htaccess file) sit on the top-level of the domain: e.g., at www.example.com. My .htaccess file looks something like this: Rewrite...

Apache mod_rewrite going berserk - redirecting where it shouldn't

I have a script that echoes a meta redirect to a page called account_management.php5, but for some reason it automatically redirects from there to index.php5. My .htaccess file handles a couple of redirects automatically, for example index.html|php5 to the domain root, and that's the only place I can see this problem originating, but I d...

mod rewrite, trying to show a default image for ALL requests from a certain domain

This is what I have, but doesn't seem to be working. RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://(www\.)?domain.com/ .*$ [NC] RewriteRule ^.*$ http://mydomain.com/new-pic.jpg [L] ...

Problem in Multiwrite Rule

Dear all U have used rewrite url module but not able to redirect to the target page and I am getting error as The requested URL /old.html was not found on this server. Here is my code. Please see to that and suggest to me: RewriteEngine On RewriteCond %{SERVER_PORT} !^8080$ RewriteRule ^(.*)$ http://localhost/IN/$1 [L,R] RewriteRule ...

Apache Rewrite does not redirect

I'm having an odd issue where, according to Javascript (in Chrome), all of the strings I tested match the Regex I have for a RewriteRule, but not all of them redirect properly. My patterns are (in this order): ups/sections/([A-Za-z]{3})/([A-Za-z0-9_+.-]+)$ ups/([A-Za-z_+.-]+)$ and the files I tested are: (marked with + for a successf...

Redirect to 404 if .php extension is requested

Hey, When a user requests a page that ends with .php, I want to send them a 404 error even if the page exist. Is that possible to do with .htaccess/mod_rewrite?? http://mysite.com/whatever.php ...

htaccess mod rewrite w/ dynamic match

I am moving a blog from one server to another and adding a subdomain, so the path will change from - http://www.example.com/queen/index.php/2009/winners-and-losers/ to - http://blogs.example.com/queen/2009/winners-and-losers/ What mod_rewrite rules would I add to the .htaccess under /queen/ on www.example.com to 301 redirect to t...

Cannot support rewrite url when mod_jk used in virtualhost

Dear all .htaccess file cannot support when mod_jk connector used in virtualhost created in httpd.conf .htaccess file RewriteEngine on RewriteRule ^index\.html$ index.iface httpd.conf <VirtualHost 112.109.128.170:80> ServerAdmin "[email protected]" ServerName www.vpaycash.in MIMEMagicFile /dev/null CustomLog logs/...

Regex rewrite rule not working in .htaccess

I have an .htaccess file that's using several rewrite rules. They don't seem to be working on a server I'm testing on, but they work on another server. I tested using a rule that doesn't use a regex, and that seems to work. Is there any way that regex rules can be disabled (or enabled) in Apache? ...

Good .htaccess/mod_rewrite/url-rewriting tutorial

Can you recommend me a very detailed URL rewriting/mod_rewrite tutorial that explains the whole process to the end, not just the basics? I have found numerous URL rewriting tutorials out there, each of them basic level. I understand why we use it, how we use it, what are regular expressions etc. What I am interested in is a very detail...

mod_rewrite help to change Content-disposition based on URI

I have a directory of mp3 files want to have be able to serve them inline or giving the user an option to download based on the request URI. /media/file1.mp3 -- in this case, I just want to serve the file and let the browser play it. /media/download/file1.mp3 -- in this case, I want to make it easy for a user to download the file inst...

Dealing with multiple, optional parameters with mod_rewrite

I'm using apache's mod_rewrite to make my application's URL's pretty. I have the basics of mod_rewrite down pat - several parts of my application use simple and predictable rewrites. However, I've written a blog function, which use several different parameters. http://www.somedomain.com/blog/ http://www.somedomain.com/blog/tag/ http://...

Nested URLs and Rewrite rules in Apache2

Hi, I need some help with rewrite rules and nested URLs. I am using TikiWiki for my website and am in the process of setting up SE friendly URLs for my projects. Specifically, I have the following rewrite rule for www.example.com/projects to point to a page that lists out all the projects hosted in example. RewriteRule ^Projects$ ar...

Include ":" character in parameter using Apache's mod_rewrite

I use something like that to pass to the parameter 'text' what follows after the domain RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?text=$1 [L,QSA] So if I have www.example.com/tralala I get $text='tralala' But I want it to be possible to have in the parameter the character ":...