mod-rewrite

Apache mod_rewrite help, send folder to subdomain

I want to make my .htaccess file do this: From: http://www.domain.com/example -OR- http://domain.com/example To: http://example.domain.com and From: http://www.domain.com/example/newfolder/file.html?q=blank -OR- http://domain.com/example/newfolder/file.html?q=blank To: http://example.domain.com/newfolder/file.html?...

URL Rewrite in htaccess problem

Am rather new to this world of htaccess redirects.Am trying to force all redirects in my Zend MVC to my https but I get a requested URL not found error on requests that dont go though the index controller Example https://www.example.com/auth/register gives a requested URL /auth/register not found error. However if I remove the https ...

Mod_rewrite - How to tell Google to dynamically delete pages from their index after 7 days

Search engines like to crawl and index webpages or URLs, but what if your webpages/URLs have expired content and you do not want them to be indexed after so many days? Can you put an expiration in the URL and have mod_rewrite 301 redirect pages after a given expiration date? Or maybe a cron job to add a 301 redirect header to all expir...

Does mod_rewrite work for windows servers too?

Does mod_rewrite work for windows servers too? If not, how does windows use regular expressions the same way you can using the .htaccess file in Apache? ...

php url routing question

Hi, http://mysite.com/songs/company-name/song-name i want to redirect it to http://mysite.com/songs/index.php?name=company-name&song=song-name i read some articles about that mod_rewrite but actually i couldnt understand exactyly, i appreciate if you can help me. thanks EDIT: mod rewrite is enabled ...

.htaccess is not working at all

i want to change this url localhost/classAds/classInc/home.php to localhost/classAds/classInc/home/ for this i created .htacess file as follow, RewriteEngine On #Turn on the rewriting engine RewriteRule ^home/?$ home.php [NC,L] #Handle requests for "home" and put this file in C:\wamp\www\classAds and ...

How can I set up htacces and mod_rewrite to use a domain wildcard?

The following forces non-www domains and sends https requests to http and is working fine for example.com. How can I use a wildcard for the domain? RewriteCond %{HTTP_HOST} !^example\.com$ RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$ RewriteRule (.*) http%2://example.com/$1 [R=301,L] I have two domains, example.com and example2.co...

rewrite language extension in URLs with htaccess

Hi, ` I'm having some troubles with url rewrites in htaccess. I have all my PHP pages in subfolder /pages. These are my urls: http://www.example/tickets http://www.example/en/tickets http://www.example/fr/tickets http://www.example/nl/tickets --> all these should point to /pages/tickets.php Currently I use this in htaccess: Rewrite...

How to redirect multiple folders to the reflecting subdomain with .htaccess

Hi, i tried redirecting some folders to the subdomains with the same names as the folders. I tried this way but it didn't work: RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC] RewriteRule ^(test1|test2)(.*?)$ http://$1.domain.com$2 [R=301,L] I guess the problem is that the alternation of folders doesn't return a result that i can get ...

Rewrite css images to other host

I want to speed up my website using subdomains for image and javascript requests. This is the entry of my htaccess file for images: RewriteCond %{HTTP_HOST} !^www.mywebsite.com$ [NC] RewriteRule ^(.*\.(gif|jpg|png))$ images.mywebsite.com/$1 [QSA,L] This works fine, only the images in my css file are still loaded from the www.mywebsi...

.htaccess template

I made an .htaccess template; is there anything else that should be added or changed? # DEFAULTS ServerSignature Off AddDefaultCharset UTF-8 DefaultLanguage en-US SetEnv Europe/Belgrade SetEnv SERVER_ADMIN [email protected] # Rewrites RewriteEngine On RewriteBase / # Redirect to WWW RewriteCond %{HTTP_HOST} ^serpentineseo.com Rewrit...

RewriteRule to store thousands of files in subdirectories

I have a website that will have millions of pages in a directory. I'd like to store those files on-disk in a bunch of subdirectories based on the first characters of the page name. For example http://mysite.com/hugedir/somefile.html would be stored in /var/www/html/hugedir/s/o/m/e/f/ile.html That is fairly trivial to do with a Rewrit...

Rewrite rules doesn't work apache 1.3

I'm using a couple of rewrite directives that always works before on apache2 but now trying a new shared hosting and the rewrite rules do not seem to get applied. I've reduced the .htaccess files to the following essential rules: RewriteEngine On Rewritebase /demo/ RewriteRule ^(.*)$ index.php/$1 [L] As you can see, i want to rewrit...

mod_rewrite rule to work with get method

I'm using this rule: RewriteRule ^(.*)$ public/$1 [L] and in public folder I use: $url = $_GET['url']; when I try to acess something on url using slash or it works fine and I get: /cities/display/45 => Array ( [0] => cities [1] => display [2] => 45) But when I try to submit a form, i'm not able to acces the data: /...

Redirecting all dynamic URLs from an old site to a single static url

We had an old coldfusion website a couple of years ago and I recently realized there are some old links still floating around causing 404 errors. I don't know what was on any of the pages and I just want to redirect them to a new static page. Our new site is a Joomla 1.5 site with SEF URLs turned on. An old URL would look like this: htt...

How to rewrite URL to include subdirectory?

The following set of rewrite rules rewrite any URLs formatted as http://foo.example.com/bar to http://example.com/mysubs/foo/bar.php. This all works fine except if I have a subdirectory named 'blah' in the original URL such as http://foo.mydomain.com/blah/bar, then it will rewrite it as http://example.com/mysubs/foo/bar (without the blah...

301 All aspx files to a Subdomain

We just redesigned a site for a client in EE, located at example.com (with and without www.). Their original site is ASPX. They've still got a number of ASPX pages that they want to keep, so their IT people created a subdomain, www2, which is basically a clone of their old site. I need an htaccess rule that will check if the requested...

Use Mod_Rewrite to Rewrite ROOT to Another Path

Note: I have tried the suggestions under this question but they either don't work or give me an infinite redirect loop error. I have the following in my .htaccess file: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / # Rewrite old links to new Redirect 301 /howitworks.php /ho...

Gateway page system

I'm trying to alter the way we currently provide a gateway page system within our CMS. What i mean by gateway page is mapping a non-existent URL to a page through a rewrite rule in the .htaccess, e.g. RewriteRule ^foobar$ page.php?mode=bar&method=foo&id=1 This allows people to create short links to CMS pages for magazine adverts etc. ...

Using Mod-Rewrite in XAMPP

I've followed some tutorials on how to use Mod_Rewrite, but it's not working out. I have a php index page that takes a page parameter like so: call: index?page=name1, name2, name3 etc. <?php if (isset($_GET['page'])) { switch($_GET['page']) { case 'front': include "front.php"; break; default: ...