mod-rewrite

RewriteRule, Proxy directive [P] - Is it possible to make request use actual proxy host?

Hello Everybody Does anyone know whether it is possible to make rewrite rules which use the proxying [P] directive, as shown below, to behave like ProxyPass used in conjunction with ProxyPreserveHost Off. In other words I want the server on mydomain.net to see a request for mydomain.net not mydomain.com. RewriteCond %{HTTP_HOST} ^myd...

ISAPI rewrite question on IIS

I have the following rules: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule ^blog/?$ http://blog.example.com/ [P] RewriteRule ^(blog/.*)$ http://blog.example.com/$1 [p] RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule ^(.*)?$ http://www.example.com/$1 [L,R=301] What I'm trying to achieve, and it works up ...

Mod_rewrite repetition

I am working on a website that passes all PHP scripts through a single PHP page (passthrough.php). The .htaccess file is supposed to take certain special directories and translate them into GET variables, so the controller script knows what to do with them. So: http://example.com/ajax/method.php becomes http://example.com/passthroug...

Mod-rewrite has revealed itself

I thought that apache mod_rewrite would hide the URL that is being redirected to. i.e. if a user enters http://site.com/iPhone and i've set it up to redirect to http://site.com/search.php?search=iPhone I would have expected that http://site.com/iPhone would still be displayed in the address bar? .htaccess file is: <IfModule mod_rewri...

How can I turn all rewrite x.php into x.css in a specific directory?

I need to rewrite all the files in a directory and essentially make their extentions css instead of php. I want to do with with a .htaccess file within that specific directory. What is the correct method of doing so and are there any special PHP headers I need to set the ensure the file is read as a .css file correctly? ...

Redirect requests only if the file is not found?

I'm hoping there is a way to do this with mod_rewrite and Apache, but maybe there is another way to consider too. On my site, I have directories set up for re-skinned versions of the site for clients. If the web root is /home/blah/www, a client directory would be /home/blah/www/clients/abc. When you access the client directory via a w...

How can I use "mod rewrite" to redirect a folder path to a subdomain, but without a browser redirect?

I have a file that I want to redirect to a subdomain using mod_rewrite. For example, I would like to redirect the request for http://www.mydomain.com/xyz to the subdomain xyz.example.com I don't want to send a redirect to the browser though (so it doesn't know the page is different). BTW. xyz is a CNAME record, pointing to www.otherdo...

Weird apache behavior when trying to display urls without html extension

Hello, I have a url that is easily accessible when you request it as: http://example.com/2005/01/example.html or http://example.com/2005/01/example (I actually don't know why it works without the extension. Instead, it should return the usual 404 error.) However, when I try to access the following url: http://ex...

Custom mod rewrite in CakePHP

Hello, I've rewritten my web app using CakePHP, but now I need to have my old formatted urls redirect to my new url format. I can't seem to add my own custom mod rewrite rule. I've added it above the main cakephp rewrite rule, but I'm getting an infinite redirect loop. I just want http://mysite.com/index.php?action=showstream&amp;nicknam...

Why modRewrite applies automatic .php to this simple rule?

Ok guys i have maybe a stupid problem, but i'm probably dumb :) I have this simple .htaccess: Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^news/([^/]+)$ news-inside.php?n=$1 [L] RewriteRule ^news/?$ news.php [L] RewriteCond %{REQUEST_FILENAME} !-f Every time i try to get into firs...

Mod rewrite issue

Hello, As many others I am having issues with doing some very simple mod_rewriting in apache. I have the following in my .htaccess: Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^view/([0-9]+)/([0-9]+)$ view.php?advertId=$1&publisherId=$2 [NC,QSA,L] Which is supposed to translate /view/4093/203?qs=val -> /view.p...

Rewriteengine in .htaccess to catch files not ending in html

I'd like to use mod rewrite in to convert web page addresses like /directory to /directory/index.html, in a standard LAMP hosting situation. What I have works for addresses that end in a slash. I can't find a way to handle addresses that don't end a slash. What seems like it should work is: rewriterule ^(.*)/$ $1/index.html [L] /* addr...

What do these declarations mean in my .htaccess file?

I am a newb to PHP. Can anyone tell me what each line does here. Do I need this? It is giving me errors RewriteCond %{REQUEST_URI} /~([^/]+)/? RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*) /~%1/rewrite.php?p=$1&%{QUERY_STRING} [L] RewriteCond %{REQUEST_URI} /~([^/]+)/? RewriteRule ^index\.p...

mod_rewrite multiple directories to a php file

RewriteEngine on RewriteRule ^/(dir1|dir2|dir3)/(.*)$ /targetfile.php [R,L] http://www.somesite.com/dir1 -> http://www.somesite.com/targetfile.php http://www.somesite.com/dir2 -> http://www.somesite.com/targetfile.php http://www.somesite.com/dir3 -> http://www.somesite.com/targetfile.php From what I've seen online, this should work. U...

How can I redirect my web pages using .htaccess so old links are redirected to new ones?

I have links which has an old format as www.mydomain.com/dir/this_my_page.html and my new script needs to be forwarded to www.mydomain.com/newdir/this+my+page.htm... What am I going to edit in my .htaccess file so this can be made possible? Can anyone help me with the mod_rewrite function of the htaccess? ...

mod_rewrite GUI?

Anyone have a graphical tool for developing mod_rewrite rules. Ideally it would display a pipeline of rewrites and then when given an instance of a uri would show the transforms as the get applied. It's always a pain to get them setup just right so any way of making it easier would help. ...

Redirecting an internal path to a virtual host

I have been working on a drupal test site for a while, which has a bunch of virtual hosts set up like this: <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/path/to/root" ServerName testsite1.example.com </VirtualHost> I have been using a modified host file to view each of these test sites, along the lines of: 12.0.0....

How can I rewrite all urls to "/"?

Server: Apache I'm looking to rewrite my urls in the following way, and I can't figure out a way to get it to work. http://website.com/index.html I want it to redirect to: http://website.com/ So basically I want to load index.html, but not display it in the url. I also don't want to give it another name. I'm not looking for /index...

Zend Framework: strange url rewrite behavior

I am experiencing strange behavior with my Zend Framework application. I run this url, hoping to get index controller run the 1234567890 action. http://hello.com/index/1234567890?test=http%3A%2F%2Fworld.com%2Findex.php I however get exception like this: Message: Invalid controller specified (4567890) And strangely all URLs that ar...

Help fix a small htaccess issue reguarding mod_rewrite

RewriteCond %{HTTP_HOST} ^[a-z]+.orbno.com$ RewriteCond %{HTTP_HOST} !^(www.)?orbno.com$ RewriteCond %{REQUEST_URI} download/ RewriteRule (.*) /download.php\?action=$1&user=%1 [L] Two small issues, this is the output: array(2) { ["action"]=> string(23) "download/email-logo.png" ["user"]=> string(0) "" } I want the user to...