mod-rewrite

How can I test if IIRF works?

http://www.codeplex.com/IIRF/Thread/List.aspx My webhost installed IIRF for me and I am convinced that they did not do it correctly. I've tried numerous examples including one that I know works with apache's mod_rewrite but I can't get anything to work with IIRF. Is there rule or configuration option that you guys have that you know of ...

Why would mod_rewrite rewrite twice?

I only recently found out about URL rewriting, so I've still got a lot to learn. While following the Easy Mod Rewrite tutorial, the results of one of their examples is really confusing me. RewriteBase / RewriteRule (.*) index.php?page=$1 [QSA,L] Rewrites /home as /index.php?page=index.php&page=home. I thought the duplicates might ha...

Mapping a subdomain to a Wordpress page

Any recommendations or best practices for mapping a subdomain to a Wordpress page: http://my-page.mydomain.com -> http://mydomain.com/my-page I don't want to do a redirect either, just keep the original subdomain URL until a different link is click, and then the subdomain is removed. I'm using Apache 2 with mod_rewrite, wordpress 2.7...

How to move a char from the subdomain to the filename in Apache mod rewrite?

I have this URL: http://hostX.site.com/some_path_here/filename.jpg and need to rewrite it to: http://host.site.com/same_path_here/filenameX.jpg Can you please tell me if this is possible? Basically I am trying to move "X" (it is a number) from the subdomain to the end of the filename, just before the extension. Thanks. ...

mod_rewrite regex to match only if a certain string does NOT exist

Looking through my server logs, I see that a lot of pages on my site are requesting favicon.ico, favicon.jpg, favicon.png, etc in a variety of different directories. Instead of wading through each page to try to figure out where each incorrect request is coming from, I'm writing some apache redirect rules to change a request for any url...

With Django, what's the correct way to set up paths to the admin content and static content?

I have a Django site set up that uses the Django admin panel, prefixed with /media/, as well as static site content in a directory called /static/. The admin media stuff, of course, lives within the Django package, and the site's static content is stored along with the Python code for the site. Currently, my public_html just contains ap...

mod rewrite apache

I have this in my .htaccess file <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) /index.cfm?urlparam=/$1 [L,QSA] </IfModule> urlparam only ever returns the first two parameters after the domain i.e if i type www.blahblah.com/competitions/display/competition01/ and then...

htaccess reference problem

Hey I have this htaccess code: RewriteEngine on RewriteBase /xm/ RewriteCond %{REQUEST_URI} !^/index.php$ RewriteRule ^([a-z0-9]*)\.php$ index.php?page=$1 And I want that when the user goes to, for example, main.php, that this htaccess redirects to index.php?page=main, but every time, and with every page, it redirects to index.php?pa...

Apache Redirect problem in .htaccess

Hello I am having problems getring a simple redirect statement to take effect on my Godaddy account. I have the following statements in my .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.mydomain.net$ [NC] RewriteRule ^(.*)$ http://mydomain.net/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^mydomain.net$ [NC] RewriteRule ^/lis...

Why isn't this mod_rewrite rule working as documented?

I'm trying to debug URL rewriting on a hosted site, where I don't have access to vhost.conf and so can't set up a rewrite log. How else can I debug rules that aren't working? This is the rule I'm trying to straighten out, if anyone has any insight: RewriteRule ^([^/]+)\.([^/]+)$ xslt.php [L] What I expect to have happen: URLs that h...

How to dynamically redirect www-based URLs to non-www URLs with multiple domains in same VirtualHost

I've got a VirtualHost that looks something like: <VirtualHost *:80> ServerName domain1.com ServerAlias www.domain1.com domain2.com www.domain2.com </VirtualHost> When someone visits www.domain1.com/test, they should be redirected to: domain1.com/test When someone visits www.domain2.com/test, they should be redirected to: d...

Redirect all .php traffic to .php5 files

Hi, I have a personal website with a MediaWiki installation on a shared host. The Apache configuration treats all .php request with PHP 4, and all .php5 requests with PHP5. For compatibility reasons I need to be able to use the .php extension, but MediaWiki is only available on PHP5. I tried to use the mod_rewrite engine, but I'm stuck...

Rewriting CNAME subdomain

I have a sub domain that I want to redirect to a different location using mod_rewrite. For example: subdomain.example.com -> www.example.com/subdomain I don't want to send a redirect to the browser though (so it doesn't know the page is different). BTW subdomain.example.com has a CNAME record pointing to example.com. Edit Another ex...

How to translate /en/file.php to file.php?lang=en in htaccess Apache

I'm writing multilingual website. I have several files on server like: /index.php /files.php /funny.php And would like to add language support by placing language code into URL like this: http://mywebsite/en/index.php would redirect to: http://mywebsite/index.php?lang=en And http://mywebsite/en/files.php would redirect to: ...

htaccess redirect for everything but files/directories

I am trying to create a rewrite rule that accomplishes two things: Redirect (www.)?domain.com to log.domain.com Let any other directory or file request on domain.com through without redirection This not an Apache server (it's LiteSpeed), but supposedly it supports .htaccess files wholly. This was my shot at the rule: RewriteEngine...

Mod Rewrite Question - forwarding parameters to new parameter names

Hi, I've tested the following Mod Rewrite on MAMP, but for some reason, it fails on LAMP. Any idea of what I am doing wrong? RewriteEngine on RewriteCond %{QUERY_STRING} ^newParamA=(.*)&newParamB=([0-9]*)$ RewriteRule ^newfolder/newsubfolder/$ oldfolder/oldsubfolder\.php?oldParamC=%1\&oldParamD=%2 [QSA,L] The idea is that a query suc...

Help with mod_rewrite

...

What is the best way to clean a string for placement in a URL, like the question name on SO?

I'm looking to create a URL string like the one SO uses for the links to the questions. I am not looking at rewriting the url (mod_rewrite). I am looking at generating the link on the page. Example: The question name is: Is it better to use ob_get_contents() or $text .= ‘test’; The URL ends up being: http://stackoverflow.com/questio...

.htaccess with or without slash

What do I need to do to the following rewrite rule to make it so it works whether or not their is a slash at the end of the URL? ie. http://mydomain.com/content/featured or http://mydomain.com/content/featured/ RewriteRule ^content/featured/ /content/today.html ...

Looking for some URL rewriting help

Hi everyone, My question is a simple one, but I can't seem to find the answer. I'm currently working on some URL rewriting for a website, but I have encountered a problem. Currently the most basic rule I have goes something like this: RewriteRule ^([a-zA-Z]+)/(([a-zA-Z]+)/?$ index.php?mod=$1&com$2 This works in most cases, and I have...