.htaccess

htaccess redirect query string and discard

Hello, Having trouble with redirecting a dynamic URL. This is what I want to accomplish: Redirect 301 /content/index.php?id=423 http://www.domain.com/new-page/ I tried this RewriteCond %{QUERY_STRING} ^(([^&]*&)*)id=423$ RewriteRule ^content/index\.php$ http://www.domain.com/new-page [L,R=301] but had no luck. Thank you! ...

Have .htaccess ask for password depending on domain name

We have several domain name aliases all pointing to the same server and directory (just aliases). But I'd like to password-protect (htaccess) the site when people come from certain domain names. Thanks ...

Ignore symlinks in clean URL's in .htaccess

Example URL: example.com/user /user is both a symlinked directory and a valid URL to content on my site. I user Horde Routes to request the content and all requests to the site go through index.php. I currently have a .htaccess file that looks like: Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com$ [NC] ...

Apache Hotlink Protection for Download Folder

Hello, I'm trying to avoid direct links from other sites to my site's downloadables. My exe,zip and msi files are under /files directory. How can I avoid direct links to them? Thanks in advance... ...

How to access remote .SVN with TortoiseSVN

I just started working on a new project that already contains a .svn folder and respective files on a remote server. The previous developer obviously used this file to monitor the file changes however: The .svn is in the public www but a .htaccess forwards all commands to a different directory. How do I go about figuring out the corre...

Trouble redirecting all pages in a folder to a page at root level.

I've searched, tried various examples, and none, other than creating an explicit list of redirect statements seems to work. The biggest issue I have is that, although I have access to deploy web pages to the site, I do not have access to any web hosting control panel - site access was inherited, and until now it's been fine, but I think ...

Alternative to Apache’s .htaccess file for IIS?

I'm moving a WordPress blog from Apache to IIS. It's just for a couple weeks until I get it changed out. But all I can get to is the homepage. Everything else throws errors. I think my problem is in the .htaccess file: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteC...

Make Domain-Specific folder redirect using .htaccess rules?

I recently moved a files/images folder on my site (a Drupal installation) from /sites/default/files/ to /sites/example.com/files/, but there are now a lot of 301 errors from external hotlinking sources, and I'd like to redirect inbound links from the old 'default' path to the new 'example . com' path, but only for this one domain... Bas...

URL Rewriting every URI except one?

I have a need to rewrite all URLs except /admin/ to index.html. How would I achieve that with .htaccess? I know I need RewriteConds and writes, but everything I have tried ends up in 500 Internal Server Error. ...

mod_rewrite rules for all web documents

I am in need of the rewrite rules and conditions to evoke a central PHP script for every and any web document requested on my server. Just to add, I do not want the PHP script to be evoked when requests are made for CSS, JS, PNG, GIF, JPG, and other media etc. I only want the script to be called for HTM, HTML and PHP documents in the roo...

How can I disable auto_prepend in specific folders using htaccess?

I'm using auto_prepend on my website, however I don't want it to be used in every folder. How can I stop php from auto_prepending a file within certain folders using .htaccess? (It doesn't have to be .htacces, I can use any other method but I thought I'd start with .htaccess) ps - I'm using the auto_prepend in php.ini to set the auto_p...

How to set the cache expiry period of a whole folder of jpgs using .htaccess

How can I set the cache expiry date of a whole folder of images using .htaccess? Right now, I only want the contents of one specific folder to be given a long cache expiry date. I'm currently using the following code (pasted below), but I find it a pain because every time I add a new piece of art, I have to add it to this list. Is the...

htaccess 404 error redirection for /cat/sub/.html like urls

Hi friends, How can I redirect such link (below) to 404 error page? http://www.blabla.com/category/sub/.html I generate a SEO friendly links, normally products has url like blabla.com/category/sub/product.html the page doesnt give any error. it just display blank content. I mean i can see static texts like CATEGORY NAME header a...

How do I combine WordPress permalink code and .htaccess redirect?

I'm trying to combine the following code so that the WordPress permalinks work in the main directory, waringis.com (top code) and a second domain, burrowpress.com, is redirected to the subdirectory 'waringis.com/burrowpress' (bottom code) - <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f Rewri...

Using mod_rewrite to work with a custom string

I want to rewrite everything that uses this pattern... /test/?TEXT=TRUE and allow it to be /test/TEXT AND /test/TEXT2, and so on. ...

htaccess rewriterule parent folder only

I would like to change the rewrite rule to only apply to the current folder that the htaccess file is in RewriteEngine on RewriteRule ^(.*)\.html $1\.php how do I change this to make that work? Thanks, ...

Mod Rewrite complete befuzzlement

Here is my .htaccess file Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule subpage\?sid /index.php [R=301,L,NC] My request is http://example.com/subpage?sid It keeps returning 404 Not Found, rather than redirecting to index.php I have tried not escaping the ? and changing the request to http://example.com/subpage\...

.htaccess - a potential security threat for hack?

We use .htaccess a lot for URL redirections and other stuffs. Is this any kind of a threat for web security? What are the best practices for a .htaccess file? ...

.htaccess redirect to external URL while hiding redirect

I want to be able to redirect a domain pointed to my webhosting to an external domain. For example, I have this in my .htaccess: RewriteCond %{HTTP:Host} ^(?:www\.)?mydomain\.example$ RewriteRule ^(.*)$ http://myexternal.example/site [R=301,NC] However, when I visit the domain, the URL in my address bar changes to http://myexternal...

Using htaccess to redirect requests from non-www to www (but with a twist)

I'm currently using htaccess to force all requests to use www. So: RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] to redirect example.com/page to www.example.com/page. However, this htaccess file is being used by several international versions of example.com. What code do I want th...