mod-rewrite

RewriteRule with string starting "http://"

Hi, I'm having problems working out how I can do the following using htaccess: http://isitup.org/http://example.com => http://isitup.org/example.com I think the problem is the second double slashes, but I can't think of a solution. Here's my current (failed) attempt: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME...

How do you convert a form with method="get" to a mod_rewrite url?

I have a PHP MVC Web App and Apache mod_rewrite rules already working fine, but when I create forms using method="get", the submitted URL looks like contact/submit?a=b&c=d I would like my form to submit to contact/submit/a/b/c/d Both posting and getting the form work fine on the server side, but when using post method, the back b...

Parsing Mod-Rewrite

Hello, I'm trying to get two parameters with mod-rewrite. I tried to split them with "-" but unfortunately it returns last word as second parameter. /ders/ilkogretim-matematik /ders/ilkogretim-fen-ve-teknoloji should be the URLs, "ilkogretim" will be the first parameter and the rest of it will be the second parameter. (After first "-"...

Apache: RewriteRule leads to segfault

I use a RewriteRule to replace all spaces (aka %20) in my URLs by underscores: RewriteRule (.*)[\ ](.*) $1_$2 [N] The [N] flag starts the rewrite process again, until no space is left (hopefully). Now, all is well, when there is a file waiting at the other side, i.e. request: /This is an example.html and file: This_is_an_example.h...

subdomains pointing subfolders with mod rewrite

Hi I'm quite new to PHP... And need something to do as fast as I can.. I have some clients within the "clients" directory like here... "http://domain.com/clients/client0001/fluids/..." I want this URL to be shown in the address bar like this. "http://client0001.domain.com/fluids/..." with the help of .htaccess. Any help will be appre...

Proxy URL without authentication

I have an Apache web server with basic authentication enabled at the root directory. I can't change this due to business restrictions. However, we want a particular URL to be a proxy to a different site, with different authentication, without being asked for authentication by the main site. Example: My site is http://foo.com/ If you g...

How do I redirect to my same URL without getting a too many redirects error?

I need to redirect users from http://myurl.com/Login.action to http://myurl.com/app/Login.action I tried this but I get an error saying I get too many redirects. RedirectMatch ([A-Za-z]*)\.action$ http://myurl.com/app/$1.action How can I get apache to redirect to the same URL but only redirect once. Would something like this work? R...

Apache mod rewrite ruleset

The problem is roughly - I need a request path like this: host/var1/val1/var2/val2/var3/val3/... to be overwritten like: host/index.php?var1=val1&var2=val2&val3=var3&... Any ideas ? ...

.htaccess for clean URL not working

I am working with PHP and htacess for the first time. I am passing a variables in a query string to a URL and want this URL to look clean. Please help. .htaccess file RewriteEngine On RewriteRule ^id-([0-9]+)/([0-9A-Za-z]+).html /detail.php?id=$1&display=$2 PHP code passing from one file to detail page URL is: <a href='/detail.ph...

Mod_rewrite invisibly: works when target is a file, not when it's a directory.

I have this rewrite rule that turns foo.com/test (or foo.com/test/) into foo.com/test.txt: RewriteRule ^test/?$ test.txt [NC,L] It works perfectly and, importantly, never reveals to the user that the "real" URL is foo.com/test.txt. Now I want to do the same thing where the "real" URL is foo.com/testdir, where testdir is a directory: ...

.htaccess Redirect non-WWW to WWW preserving URI string

I'm running the CodeIgniter platform, which uses .htaccess to accept URLs like http://www.mysite.com/controller/function/argument I currently use some .htaccess rewrites, namely (simplified): RewriteEngine On RewriteCond %{REQUEST_URI} !^(/index\.php|/images|/assets) RewriteRule ^(.*)$ /index.php/$1 [L] I want to add a rewrite rule...

Mod Rewrite Optional Parameters

I have a fairly complex set of rewrite rules to give my site pages pretty URLs. Right now to deal with paging of search results I'm using 2 rewrite rules: RewriteRule ^search/([0-9]+)$ /cgi-bin/search.pl?page=$1 [NC,L,QSA] RewriteRule ^search$ /cgi-bin/search.pl [NC,L,QSA] These handle URLs such as: http://example.com/search http://e...

.htaccess rewrite to default language folder?

I have my site broken down into several folders by language: / /en/ index.php about-us.php faq.php ... /fr/ index.php about-us.php faq.php ... ... etc. I'd like to have a rewrite rule that automatically rewrites to the en folder if somebody tried to enter mydomain.com/about-us.php. FYI, I als...

.htaccess mod_rewrite rule not working in Ubuntu

My apologies if this is an easy one. I have Googled it up the hizzy to no avail. I am running Ubuntu 9.04, Jaunty Jackelope and Apache2. After much trouble, I finally enabled mod_rewrite, and my .htaccess file is attempting to do it's thing, but is failing. This is my setup. In /etc/apache2/conf.d/ I have a file called apeace-public-ht...

External form causing wordpress 404 error

I have a file outside a Wordpress install that contains a form that submits to itself. I can access and fill the form out, without validation the form submits and reloads as expected, but when using javascript to submit the form I receive a Wordpress 404. The URL of the file stays the same when receiving the 404, if I refresh the page ...

.htaccess not working

RewriteEngine on RewriteCond $1 !^(index\.php|files|assets|robots\.txt) RewriteRule ^(.*)$ ./index.php/$1 [L] The website is hosted on the latest version of XAMPP locally. When I load the website with the .htaccess file in place, it won't load at all. I get a server error What am I doing wrong? EDIT: Checked log file, here's an error...

.htaccess and url

Is it possible somehow using mod_rewrite change the url from http://www.mywebsite.com/company/123/reviews to http://www.mywebsite.com/company-123/reivews? It's not a redirect. The problem is that the real path is the first one and I need my browser to display the second path. So when the user goes to company-123/reviews the content of t...

What does [L] mean in apache rewrite?

Like here: RewriteEngine on RewriteRule ^(.*)\.[\d]+\.(css|js)$ $1.$2 [L] ...

Mod_rewrite with "http://" in Querystring

I'm trying to create a rewrite rule that will do the following: http://www.example.com/http://other.example.com → http://www.example.com/index.php?var=http://google.com This is my current rule: RewriteCond %{REQUEST_URI} ^/(http[s]?\:\/\/|ftp\:\/\/)?(www\.)?[a-zA-Z0-9-\.]+\.(com|org|net|mil|edu|ca|co.uk|com.au|gov|ws|info)$ RewriteRul...

using mod_rewrite to redirect from subdomain to maindomain

Hi! My problem is that i have a functioning subdomain (sub.mydomain.com). sub is loaded in mydomain.com/sub. What i would like to do is to redirect all requests to sub.mydomain.com to mydomain.com. Somehow it seems that when im the subdomain i cannot access the rootfolder (main domain). I can get it working with from mydomain.com/sub ...