mod-rewrite

mod_jk conflicts with mod_rewrite

Hello I've got an Apache and Tomcat running and I use mod_jk to bind them. I have a Tomcat worker called "tc1" and the following setup on my VirtualHost: JkMount /* tc1 JkUnMount /*.png tc1 JkUnMount /*.gif tc1 JkUnMount /*.css tc1 JkUnMount /*.js tc1 That way Tomcat serves all requests apart the ones for static files. Now I want ...

Redirect website root to subdirectory

How can I redirect all requests going to web root to another folder (e.g. public/)? I've already tried this (contents of .htaccess in web root): RewriteEngine on RewriteRule ^(.*)$ public/$1 But now I have duplicate content for addresses: address.tld/ and address.tld/public/ I would like to redirect address.tld/public/ to address.tl...

mod_rewrite new URL for pages plus wordpress?

I need to change the domain for both a wordpress and a number of hand-coded pages. Is there a way to write something in .htaccess so that www.olddomain.com/* goes to the corresponding www.newdomain.com/* for everything? ...

How to Redirect to a url containing an anchor (#)?

I need to take standard incoming urls and rewrite redirect them to target specific anchors on a single page (incoming html page name becomes the anchor name). E.g., the rule would be like this: RewriteRule ^files/([a-zA-Z0-9\-_]+)\.html$ /test.html#$1 [R] So this url: http://foo.com/files/bar.html ...would become: http://foo.com/...

Simple rewrite rule for a nginx + apache2 with mod_wsgi

Hi guys, I'm stuck with this, my skills in the web servers area are poor... I have an Nginx acting as a proxy for an Apache2 running with mod_wsgi and mod_rewrite. What I want to do is rewrite every URL from www.example.com to example.com, i.e. stripping the www part from each URL request before serving. This is the layout of the differ...

Problem with URL rewrite of host-header.

I'm trying to use ManagedFusion UrlRewriter module on my main/root web site to redirect requests with a certain host name to a sub-folder of the root. Let's say my root is called profkroot.com, and it has a sub-folder (ASP.NET application) called cottages. I also have a domain called profkcottages.com, which I'm trying to redirect to p...

Mod_Rewrite Question

Hello, I'm trying to forward example.com/signup and example.com/signup/ (with trailing slash) to example.com/signup.php I wrote following to .htaccess and it works for example.com/signup/ but doesn't work without trailing slash... How can I solve the problem? RewriteEngine On RewriteRule ^question/(.*)-(.*) /question.php?qid=$1 Rewrit...

How to detect mod_rewrite without apache_get_modules()?

Is it possible to detect mod_rewrite in PHP when function apache_get_modules() is not available? ...

Match all subdomains except one in mod_rewrite

Ok, so I'm doing a mod_rewrite, and I'm in a situation to where I need to match any subdomain except for one. It starts out looking like this. RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$ [NC] So that matches and captures a single subdomain, no periods. But let's say I don't want to match the submdomain named 'dog'. I tried to do...

URL Rewrite to exclude existing directories

I'm trying to redirect URLs from example.net/customname or example.net/customname/ to example.net/my/home.php?username=customname . This in itself is not complicated: RewriteRule ^([a-zA-Z0-9_-]+)$ my/home.php?username=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ my/home.php?username=$1 However, I want to exclude my existing directories and fi...

mod_rewrite ecommerce URL design

I have problems with how I should structure my product listing pages, products pages, webpages. It roughly translate into this: /bags/nicebag.html = /product.php?product=nicebag&category=bags /nicebag.html = /product.php?product=nice_bag /bags = productlisting.php?&category=bags Problem is that webpages will share same URL structure...

How Do I Serve a File Through JSMin PHP Script With Correct HTTP Caching (using .htaccess?)

I'm using the PHP script for JSMin to remove comments and whitespace from my javascript and css files before serving. If I set <script src="jsmin.php?file=myfile.js"> the file is not ever cached, since the Last-Modified HTTP header is never checked for a script. So in order to run the files through JSMin and (hopefully) enable cach...

Redirect dynamic subdomain to same subdomain with subpage. How?

Hello, I'm a little stuck in here. I need to get some help with this subdomain-situation. I need to redirect http://dynamicsubdomain.example.com/ to http://dynamicsubdomain.example.com/account/welcome.html. How do I do this? I tried several things but all without result. The main problem is that I can't fetch the entered dynamic subdom...

What's wrong with this mod_rewrite rule?

Can anyone spot what is wrong with this URL rewrite? I can't get it to pass anything to GET (the script loads, but no parameters are passed): RewriteRule ^archive(/(.*))?$ archive.php?action=$1 [QSA,L] I want to map "archive/browse/" to "archive.php?action=browse". ...

Apache mod-rewrite folder overwrite

Hello, I have Apache installed with the XAMPP package, and I'm working locally. I have a rule in a .htaccess file that overwrites everything, let's take this for example: RewriteRule ^(.*)$ index.php?x=$1 Note that I do NOT have any RewriteCond that makes this rule ignore existing file or folders. Now let's say I have a folder name...

What is the best way to implement a friendly URL that has multiple variables using mod_rewrite?

Hi I am building a web application that is client side js heavy with data being pushed in chunks from the server. I am trying to implement a solution for a friendly URL solution that takes a URL like: http://exmample.com/find/SomethingHere-or-there That equates to a series of variables not visible. So it might end up processing ...

mod rewrite in Expression Engine: removing directory in URL

Hello, I am working in expression engine CMS and I have some rewrite code to remove the index.php from the URL but on some of my URLs I want to remove the directory /site/ before the file name. Like I have /site/pennsylvania_attorneys.html I want to remove the site part and just have it read /pennsylvania_attorneys.html The current m...

Passing Non Existing Directory As a parameter in IIS or Apache

First look at this url: http://stackoverflow.com/questions/tagged/xoxoxo/ This directory does not exists but somehow stackoverflow can pass that last directory as a parameter to his base script. Is this possible to configure IIS or Apache to do so? How? ...

Apache modrewrite htaccess problem

Hi, I have a rule, that gets up to three parts, separated by a / (slash). They represent /app/controller/action, but they are optional, which means /, /app, /app/controller work as well. The thing is, I want another rule, before this one, which would set the default app to "frontend", and I think it should look like this: RewriteRule ...

Google juice with subdomains and porting an application using rewrite rules

Background: I've got a web app on sub.domain.com. My primary website is on domain.com. My sub.domain.com pages are stuffed with keywords that I would like to use to get upped in pagerank on domain.com. however, the whole app has been written on sub.domain.com, and it'll be some effort to host it at domain.com/subdirectory, due to how ...