.htaccess

.htaccess Redirect from subdomain to domain

I've tried a bunch of examples here on SO and modifed them, but none are exactly what I need and as a result either fail with 500 server errors (meaning the rewrite rules are wrong) or redirect just the subdomain to the domain and not any of the full URLs of pages. I need to redirect all URLs under blog.mydomain.com to www.mydomain.com/...

Htaccess.. changing the domain name.

Hello, I have a big Joomla website that was moved from .com to .eu domain. The sites are on one web server. On the old website there are a lot of links that point directly to oldwebsite.com/somethinghere. Is there a way with Htaccess file in the old domains folder to redirect from oldwebsite.com/somethinhere to newwebsite.eu/somethin...

Redirect not working for complex rewrite rules (.htaccess)

Hello, I'm trying to make a redirect from a non-www version of the link to the www one. Its working fine for something like http://mywebsite.com but it fails for a request like http://mywebsite.com/artists/metallica/ or even a complex one. The whole .htaccess file is bellow. Any clues? Options +FollowSymLinks RewriteEngine On Rewrite...

How to make this mod rewrite

This drives me crazy, it should be easy but I can't... I need to rewrite URLs like this ones: www.domain.com/foo/bar/more/evenmore.htm www.domain.com/foo/bar/more.htm www.domain.com/foo/bar.htm www.domain.com/foo.htm into: www.domain.com/?var1=foo&var2=bar&var3=more&var4=evenmore www.domain.com/?var1=foo&var2=bar&var3=more www.domai...

CakePHP and .htaccess: how to redirect url with query string

I wanted to redirect this url from /main.php?page=pages&id=gettingpaidfortakingsurveys to /main/pages/getting-paid-for-taking-surveys. Thanks! [UDPATE] i tested it on my existing cakephp .htaccess and it didn't work. <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^/main.php?page=(.+)&id=(.+) /main/$1/$2 [NC] RewriteRule ^$ ...

htaccess redirection from domain.com to sub.domain.com while maintaining file access to folders

I'd like to redirect a website from http:// domain.com & http:// www.domain.com to http://v2.domain.com, while maintaining access to http:// (www.)domain.com/images/* I've tried several methods but somehow I can no longer access the /images folder anymore. P.S: both subdomain & root has different content/CMS. Any ideas as to how to im...

How to modify .htaccess for web app (in combination with WordPress 3.0.1)

My question is about .htaccess I am using WordPress 3.0.1 as the front end of my web application. I want most HTTP accesses to follow the normal WordPress flow. However, I have created a special "Page" in WordPress that has embedded PHP code that powers my web app. URL's of this form "http://site.com/app/" already go to the correct pa...

.htaccess regex in RewriteRule matches, variables remain empty

I have some conditions and rules in my .htaccess: RewriteCond %{DOCUMENT_ROOT}/assets/img$1/.$2.$4/$3.$4 -f RewriteRule ^assets/img(.*)/[a-zA-Z0-9-_\.]*\.[^/]+\.[a-z]{2,4}$ assets/img$1/.$2.$4/$3.$4 [NC] RewriteRule ^assets/img(.*)/[a-zA-Z0-9-_\.]*\.[^/]+\.[a-z]{2,4}$ assets/img/image.php?path=$1&file=$2.$4&template=$3 [NC,L,QSA] The ...

.htaccess redirect doens't work correctly

Hi, I'm using a .htaccess to get all documents from an old site to the new one. The old site doesn't support PHP or mod_rewrite. I tried the following code: Redirect 301 / http://www.new.com/archive/ I requested " http://www.new.com/archive/index.html" Which resulted into http://www.new.com/archive/old.com/olddir/&amp;&amp;&amp;/&am...

Wordpress .htaccess mod_rewrite rules

I'm currently building a Wordpress powered website that is distributed across three servers, two of which are used to server the front end (Live), and another of which is used for the admin (Admin). The codebase on all three servers is exactly the same, and comes from the same subversion repository, we need to keep it this way so that w...

How would I write a RewriteRule to make redirection

I want to rewrite the html and xml files and directories to the pagename query string using .htaccess file. like this : mysubsite/category_1/category_2/ mysubsite/category_1/category_2/file1.html mysubsite/category_1/category_2/file2.152.html index.php?pagename=category_1/category_2/ index.php?pagename=category_1/category_2/file1.html ...

.htaccess questions

Say I have the following .htaccess file: RewriteEngine On RewriteCond %{HTTP_COOKIE} name=value [NC] RewriteRule ^image01.gif$ http://www.domain.tld/images/partner/image01.gif [NC,QSA] RewriteCond %{HTTP_COOKIE} name=value [NC] RewriteRule ^image02.gif$ http://www.domain.tld/images/partner/image02.gif [NC,QSA] What do NC and QSA mea...

Replace invalid image url with 404 image

I don't know if this is possible or not, I have an image host that I've made myself. I need some last tweaks with it. Whenever an image has been deleted or is an invalid image url, it should replace with an 404 image, so for example if someone adds this: http://imagehosturl.com/i/34njk5n.jpg But it's an invalid link, so I need it ...

Add Trailing Slash to URL

My current .htaccess file looks like this: RewriteEngine on RewriteBase / Options +FollowSymLinks -Indexes RewriteRule ^video/(.*)$ video.php?id=$1 [L] RewriteRule ^video/(.*)$([a-zA-Z0-9]+) video.php?id=$1 [L] RewriteRule ^tag/(.*)/page-(.*)/$ tag.php?tag=$1&page=$2 [L] RewriteRule ^tag/(.*)/page-(.*)$ tag.php?tag=$1&page=$2 [L] Rewr...

Redirect domain.com/something to domain.com/?page=something with .htaccess

How can I redirect domain.com/something to domain.com/?foo=something using .htaccess? I have a code that does a similar thing: RewriteRule ^go/([a-z]+) http://domain.com/?foo=$1 [NC,R] This will do, in e.g. domain.com/go/something redirect to domain.com/?foo=something It's probably easy to do but I can't make it work.. anyo...

Why isn't this .htaccess file working?

Recently, my website was hammered with thousands of POST requests from various bots. Instead of taking the approach of blocking these bots based on their user agent, I've decided to find a way to block all POST requests sent to my website and allow all POST requests from within my website. I came up with the following: RewriteEngine ...

htaccess rewrite question

Hi, I want to rewrite the url http://mydomain/myapp/fakefolder to http://mydomain/myapp/index.php I tried the following rule but thats not working RewriteEngine On RewriteRule ^fakefolder$ index.php The .htaccess file is located inside myapp. Kindly help Thanks vineet ...

.htaccess 300 handling

I have a page mypage.html which I need to change to mypage.php. If I upload mypage.php and remove mypage.html, I get a 300 Multiple Choice error from Apache. Can I set the htaccess to check if a .php verion of a page is available before it shows an error? ...

Making a 301 rewrite from within a folder using relative rewrite URLs

I have the following problem. We used many different URLs to the same page. Now we want to use only one URL for those pages. Here an example: RewriteRule ^(subfolder1/folder1/|(subfolder2|subfolder3)/folder2/|folder3/)?(name1|name2|name3|name4)$ scriptname.php [QSA,NC] As you can see it is pretty messy. What I now want to do is the fo...

remove .php extension with .htaccess

Yes, Ive read the apache manual and searched here. for some reason I simply cannot get this to work, the closest Ive come is having it remove the extension but it points back to the root directory, I want this to just work in the directory that contains the .htaccess file. I need to do 3 things with the .htaccess file. 1.I need it to ...