.htaccess

Redirect directory to file using htaccess?

I'm trying to do something like this... Redirect mysite.com/directory/ To mysite.com/directory/do But ONLY when "/directory/" is opened without pointing to a file. I am aware that "DirectoryIndex" can help with this, but I want the file's name (which is "do") to appear in the url the users sees. Is there a way to accomplish this with ....

Mod Rewrite variable contains a url with special characters

Hi all, I recently discovered mod rewrite and I was wondering if it's possible to rewrite a variable which contains an outbound url. So far it is not working at all. I assume it is caused because of the special characters in the variable and I have no clue how I can solve this. My .htaccess code so far: Options +FollowSymLinks Rewr...

htaccess, Main Site Directory change

I use lunarpages for my hosting, and can have multiple websites added on. When I add a new website, it creates a directory in where my current site exists ie my site is jeffkilroy.com, if I make a domain for hello.com, it now also exists at jeffkilroy.com/hello This is fine except I would like to organize it a bit better so that the si...

htaccess internal rewrite across domains?

I'm trying to point a subfolder from one domain to another on my vhost (mediatemple). I want to use internal rewrites, not 301 redirects. Here's the goal http://www.clientdomain.com/blog/$1 --> http://www.mydomain.com/wpmu/clientdomain/$1 On the server side, the structure looks like this: /x/y/z/domains/clientdomain.com/html/blog/ --...

Recording logins for password protected directories

I have a folder in the webroot at http://somesite.com/folder which I'm password protecting with the directory password protection feature in cpanel which I guess uses some form of htacccess. So it's not protected with a normal login system that's connected to a database that I can check against. Once a correct username and password is ...

PHP and .htaccess redirect woodoo

Hi, I'm a little stuck with with my .htaccess redirect. It was working find while I was with PHP4 but the recent move to a new host with PHP5 have changed things for which I've no clue. I run a URL shortening service for NSFW links so they're a little safer at nsfw.in Here, for a URL like http://nsfw.in/e72b0f (this one is actually SFW...

How about failed attempts for htaccess password protected directories

This question is related to a previous question I asked, but it's a different. I'm using htaccess to control login to http://somesite.com/folder. Once logged in, I have php code in folder/index.php to check the username and password used to login: $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']. I log that info to a database. ...

htaccess rewrite everything but index and root

I'm trying to set up a site that forwards everything but the root directory and index into a variable. I have the htaccess file set up like this right now: Options +FollowSymlinks RewriteEngine on RewriteRule -(.*)$ http://blah.com/blah.php?name=$1 [R,NC] just so that the index works and anything that starts with a hyphen(-) is rewri...

500 error when setting up directory protection with mod_authn_dbd

I'm trying to use mod_authn_dbd to password protect a directory. I used the code from their apache help page, but it's chocking on the DBDriver line # mod_dbd configuration DBDriver mysql //modified DBDParams "dbname=mydbname user=myuser password=mypass" //modified /path/to/folder/.htaccess: Invalid command 'DBDriver', perhaps missp...

Using .htaccess to create clean URL structure

How do i redirect website.com/path/?p=4927304 to website.com/path/4927304 where the number is dynamic. Many thanks ...

How do I remove a variable name from a URL using htaccess?

So basically I want users to be able to go to my website with a URL of something like /45678, instead of having to use /?p=45678, so really I just want to remove the variable name. I've tried using mod_rewrite, but it seems that is only for removing the name when the page is visited. Thanks for the help, -Tom Update: Here is the curre...

Is it possible to (virtually) move a site from www.example.org/ to www.example.org/new/ with htaccess?

I'm wondering if it is possible to upload a site to the root directory, but not make it already visible for public (and Google for SEO reasons). And what is the best way for that? Is it possible with some rules in the .htaccess file to let it look like the site is www.example.org/new/ instead of www.example.org? Thanks ...

Help with Regex to match and rewrite URI

I need to have a RegEx that will match a URI like this based on the subdomain "blog"-- http://blog.foo.com/2010/06/25/city-tax-sale/ and redirect like this (getting rid of the subdomain and numbers/date)-- http://foo.com/city-tax-sale/ where the last bit "city-tax-sale" would be a wildcard. So basically any incoming URI that starts ...

Redirect request using .htaccess

I need to do the following Redirect using .htaccess http://example.com => https://example.com/subdirectory http://www.example.com => https://example.com/subdirectory https://example.com => https://example.com/subdirectory https://www.example.com => https://example.com/subdirectory but i do not want to show sub directory in...

HTACCESS RewriteCond without messing up localhost

I have the following bunch of domains: myDomain.de myDomain.com myDomain.co.za myDomain.org myDomain.com myDomain.com.na What is the shortest way to write in the htaccess, to make ALL domains... Redirect to https://www.myDomain.com. I.e. Regardless of the domain that is entered, it will add www AND redirect to https, and Still work...

Htaccess rule to move entire site into a folder?

I have two folders in httpdocs site_v1 site_v2 I would like to redirect the entire domain to site_v2 but also to keep reference to this so this would work www.example.com -> gets into site_v2 www.example.com/site_v1/ -> gets into site_v1 www.example.com/site_v2/ -> gets into site_v2 How would be the htaccess directives for this ki...

Serving Large Protected Files in PHP/Apache

I need to serve up large files (> 2gb) from an Apache web server. The files are protected downloads, so I need some kind of way to authorize the user. The CMS I'm using uses cookies checked against a MySQL database to verify the user. On the server, I have no control over max_execution_time, and limited control over memory_limit. My tec...

.htaccess and .htpasswd to prevent access to folder problem

Hi, I have a website admin area I want to protect with a password.. so inside the admin folder I put an .htaccess and .htpasswd files containing this: .htaccess: AuthUserFile C:/wamp/www/website_project/admin/.htpasswd AuthName "Restricted Area" AuthType Basic Require valid-user .htpasswd: (generated using an online tool) admin:sOS...

Cakephp htaccess mod_rewrite on GoDaddy

Hi All: I have a godaddy hosting account and having some problems with routing. The files are under /cakephp under the default /html folder. The full url is still showing instead of the desired www[dot]domain[dot]org Please help. The current setup /cakephp/.htaccess RewriteEngine on RewriteBase /cakephp RewriteRule ^$ ap...

htaccess ForceType application/x-httpd-php....

This is probably going to seem a little strange but we are using <Files "*"> ForceType application/x-httpd-php </Files> Which of course forces all files to give html/php headers.. The reason I am doing this way is because were using a bunch of extention'less php files. I know there is plenty more efficient ways of doing this but my b...