.htaccess

Configuring wordpress .htaccess to view subfolders

I have a WordPress install and a .htaccess that looks like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress I tried installing a fresh install of WordPress into a subdirectory ...

Find the page that the user intended to see

I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod_rewrite solution to redirect all old links to new pages. However, as I'm sure a few links will slip through the net, I've built a small script that runs on my custom 404 page, to log the incoming visitors' referrer UR...

How can I fix my .htaccess to resolve URLs that don't end in slashes

I am using wordpress and use custom permalink structure: /%category%/%postname%/ My problem is that a decent number of people link to the site without including the trailing slash in the URL, so users get a 404 page. I'm using the default .htaccess file that comes with wordpress because no solution I've tried has worked. I've tried usi...

.htaccess redirect performance

Are htaccess redirects any slower/put any more strain on Apache than redirects in configuration files? Also, how big can a number of redirects in htaccess get before they start decreasing performance? ...

Is it safe to deny access to .ini file in .htaccess?

I have a .ini file with sensitive information in my php wab app. I denied access to it using a .htaccess file: <files my.ini> order deny,allow deny from all </files> I don't have access to folders outside of htdocs, so I can't move the .ini file out of browsable territory. Is my solution safe? ...

Run index.php rather than listing files

I have recently reinstalled MacOSX, and at some point (without realizing it) I made it so that a directory without index.html would try instead to run index.php. This has since stopped working. My localhost runs .php files fine; it just doesn't do so unless you specifically tell it to. There are lots of htaccess guides online but I can...

.htaccess or .htpasswd equivalent on IIS?

Does anyone know if there is an equivalent to .htaccess and .htpassword for IIS ? I am being access to migrate an app to IIS that uses .htaccess to control access to sets of files in various URLs based on the contents of .htaccess files. I did a google search and didn't turn up anything conclusive. Is there a general approach or tool t...

htaccess request forwarding if internal ip

Is there a possible htaccess directive that can transparently forward request from index.php to index_internal.php if the request is coming from an internal ip range? ...

Apache modrewrite .htaccess question

I want to be able to rewrite a URL from: // examples http://example.com/location/New York, NY --> http://example.com/location/index.html?location=New York, NY http://example.com/location/90210 --> http://example.com/location/index.html?location=90210 http://example.com/location/Texas --> http://example.com/location/index.html?locat...

Apache/.htaccess - password-protecting a domain but whitelisting certain URIs within it

So here's what I'd like to do: access to http://example.com/* would require the user to enter a username/password, except when they go to a certain URIs (e.g. http://example.com/contact/ , http://example.com/blog/, etc.) they shouldn't have to authenticate. http://example.com (the root) should be open, too. I know I've got to set up so...

Apache .htaccess mod_rewrite and clean urls

Ok. So I'm building this site which is accessible through two different domains. So I can't use RewriteBase in my .htaccess. The rules (below) I use to work around this problem seem to work fine. However, when I use the below .htaccess settings on my local box with clean URLS (WAMP) it all works fine but the moment I use this on the live...

mod_rewrite, php and the .htaccess file

I'm coding a small CMS to get a better understanding of how they work and to learn some new things about PHP. I have however come across a problem. I want to use mod_rewrite (though if someone has a better solution I'm up for trying it) to produce nice clean URLs, so site.com/index.php?page=2 can instead be site.com/tools By my underst...

.htaccess Redirections

Hi, I've been Googling around for .htaccess redirection information, but nothing I find is quite what I'm looking for. Basically, I want a solution that will take a site example.com and allow you to enter URL's like: 123.example.com ksdfkjds.example.com dsf38jif348.example.com and this would redirect them to: example.com/123 example....

Passthrough <filname>.png to <filename>8.png if IE<=6 and <filename>8.png exists

I just found out that by converting PNG32 to PNG8 via Photoshop will fix the PNG transparency bug in IE<=6. So I had this thought that instead of serving PNG32 to all browser, why not serve PNG8 if the client is using IE<=6. I'm not really an expert when it comes to htaccess/httpd directives so I'm here for help. The title is the p...

.htaccess Problem

I'm having trouble with redirecting urls using the .htaccess file. This is how my htaccess file looks like: Redirect 301 /file-name/example.php http://www.mysite.com/file-name/example-001.php Redirect 301 /section-name/example.php http://www.my-site.com/section-name/example-002.php RewriteEngine on RewriteCond %{HTTP_HOST} !^www.mysite...

Apache Mod Rewrite (.htaccess)

Given my current .htaccess file, how would I modify it to check for an additional URL path like '/src/pub/' and rewrite it to '/' without affecting the current rewrite? Here's the original .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,...

Hidden features of mod_rewrite

There seem to be a decent number of mod_rewrite threads floating around lately with a bit of confusion over how certain aspects of it work. As a result I've compiled a few notes on common functionality, and perhaps a few annoying nuances. What other features / common issues have you run across using mod_rewrite? ...

Want to redirect all visitors except for me [.htaccess]

Basically I'm about to start work on a site and I'd like something that I can add into my .htaccess file (or elsewhere) that'll work like this pseudo code: (my ip will be in place of 127.0.0.1) if (visitors_ip <> 127.0.0.1) redirectmatch ^(.*)$ http://www.example.com/under-construction.html Hopefully that makes sense... ...

How do I gzip my web files

As prescribed by Yahoo!, gzip'ng files would make your websites load faster. The problem? I don't know how :p ...

How can I force some pages to end in a slash [.htaccess]

This is a multi-site problem. I have a lot of sites with .htaccess files with multiple line similar to: rewriterule ^(page-one|page-two|page-three)/?$ /index.php?page=$1 [L] This means that both www.domain.com/page-one and www.domain.com/page-one/ will both load www.domain.com/index.php?page=page-one However I'm always told that it ...