mod-rewrite

Rewrite url for missing resource

For each web request (file or directory) that doesn't start with /en-US/, I want to serve up the original resource if it exists, otherwise serve up the /en-US/ version. How would I do this using rewrite rules in a .htaccess file? ...

Redirect based on Accept-Language

I need to honor the web browser's list of language preferences. Supported languages are English and French. For example: http_accept_language="jp-JP;fr;en-US;en" redirects to a directory called /French/. How can I do this with rewrite rules in my .htaccess file? ...

Use symfony 1.4 without changing apache configuration

Is it possible to set the /web directory as webroot without changing apache configuration file? I tried using the following .htaccess code, but if i go to localhost/module/, it displays 404 error. But if i go to localhost/web/module/ then everything works. <IfModule mod_rewrite.c> RewriteEngine on RewriteRule sf/(.*) lib/vendo...

apache mod_rewrite redirection problem

ok i am having a problem with redirection on apache, i have a domain configured on my hosting account but the domain needs to be redirected to a folder. eg: / is root of server where the mysite.com answers /mysite is where the files are so i got this htaccess code to do the job: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTT...

RewriteCond and Full QUERY_STRING

I'm having hard time getting my head wrapped around this one - and it should be trivial. I would like to redirect one URL with a specific query string to another URL. I want to send any requests that contain the query string in the URL http://example.com/index.php?option=com_user&amp;view=register To: http://example.com/index.php?o...

Themes outside application.

Hi all I read http://forum.kohanaframework.org/comments.php?DiscussionID=5744&amp;page=1#Item_0 and I want to use similar solution, but with db. In my site controller after(): $theme = $page->get_theme_name(); //Orange Kohana::set_module_path('themes', Kohana::get_module_path('themes').'/'.$theme); $this->template = View::factory('lay...

Need help with regular expressions - URL redirection

Hello everyone. I'm trying to redirect an easy to remember url to a php file but I'm having some trouble with the regex. Here's what I have at the moment: RewriteRule ^tcb/([a-zA-Z0-9]{1,})/([a-zA-Z0-9]{1,})/([a-zA-Z0-9]{1,}) /tcb/lerbd.php?autocarro=$1&tipo=$2&dsd=$3 It is working but only if I supply all 3 arguments. I want the la...

url rewriting in php

Hai I have one more doubt in apache mod_rewrite. I want to rewrite the url mydomain/index.php?category=1&id=1 To mydomain/index/category/1/id/1 How I write rule in .htaccess And what is the link that i have to give inside the a tag Please give me a solution.. ...

Problem with .htaccess (mod_rewrite). RewriteRule's doens't work correctly

Hello, I have a problem with my two RewriteRules. .htaccess: # protect the htaccess file <files .htaccess> order allow,deny deny from all </files> RewriteEngine On Options +FollowSymlinks Options -Indexes RewriteBase /test/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^download/([0-9]+)$ dow...

Wordpress URL Rewriting Ignores Existing Files

I have wordpress installed at the web root directory of a server. I also have a file called test.php in the same directory that is not at all related or connected to wordpress (atleast not by any code within the test.php file). if i go to http://myurl.com/test.php i get my theme's styling and the wordpress error message for when it can't...

Prepend 'www' to an HTTPS url using .htaccess & mod_rewrite

I have a dilemma with this one. With the following code I am able to force SSL on any non SSL url, however when the user (and results from Google) take the user to http://mysite.co.za then we hit an issue as the url is then rewritten to https://mysite.co.za Due to the fact that my certificate is bound to www.mysite.co.za it immediately ...

Rewrite URL on submit form

Hi, I have a search form and when I make a search I get this URL "http://**/video/view/search/?imeto_tam=tarsene" but I want to replace this the "?imeto_tam=tarsene" with the word I search for and my address to look like this - "http://**/video/view/search/tarsene". Generally I use mod_rewrite on my site and it's working for my links but...

Problems with mod_rewrite and 301 redirects from one dynamic url to another

Hey all, I'm having all kinds of problems with a bunch of apache redirects just now and could really use some help! I'm wating to put in a 301 redirect for a load of urls from a client's old site to their new site in the following format; Old - page.php?pageNum_rs_all=0&totalRows_rs_all=112 New - page/sub?foo=bar The values in the que...

htaccess redirect to www excluding subdomains both https and http

So this is what I currently have, I'm trying to redirect http://something.com to http://www.something.com but if its a subdomain do no such things, so http://other.somethings.com will stay the same AND conditional based on https/http Currently have.. RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301...

modrewrite RewriteRule problem

I am using Apache 2.2 and mod_rewrite. I would like to take the following urls and map them to another url. The pattern is simple and like this: http://domain/test/ex1.html -> http://domain/app/index.php/content/?name=ex1 I tried the following in an .htaccess file (place in /test/ directory in docroot): RewriteEngine On RewriteBase /a...

Using - Instead of + in WordPress Search Permalink

Options +FollowSymLinks RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]+ /(#[^?& ]*)??([^& ]*&)?s=([^& ]+)[^ ]* HTTP/ RewriteRule ^$ http://wordpressblog.com/search/%3? [R=301,L] Currently I use the above .htaccess mod_rewrite rule to convert default WordPress search permalink: http://wordpressblog.com/?s=key+word into nice per...

Complex .htaccess rule help

I'm struggling to write a .htaccess file. I need to redirect addresses such as: /archives/YYYY/MM/post-name to /blog/post-name Any help would be appreciated! ...

Redirect all traffic but "beta" sub-domain to Splash screen (mod_rewrite)

Hi, I'd like to redirect all my traffic to my root domain, the root domain being a Splash screen. I'd like to do this ONLY when the %{HTTP_HOST} is not beta.example.(com|es|fr). So I've tried the following in my .htaccess file, with no luck... (infinite loop... I guess it's not getting the REQUEST_URI condition, but cannot figure out w...

rewrite .htaccess for a link like http://DomainName.com/UserName

Hello, I want to do a .htaccess rewrite, which when users enter this http://DomainName.com/UserName should go to http://DomainName.com/UserDirectory/UserName, but should show http://DomainName.com/UserName to the user Thanks Jean ...

mod_rewrite htaccess redirect on specific request

is there a way to make mod_rewrite redirect all urls contain the following request: ?do=page&f=* to a specific page? for example: http://example.com/index.php?do=page&amp;f=2 http://example.com/index2.php?do=page&amp;f=4 http://example.com/page.php?do=page&amp;f=22 to: http://example.com/custom.php ...