.htaccess

Is it possible to redirect traffic from page that doesn't exist to existing page with .htaccess?

The issue I am trying to solve is that I have a folder with a name that has funny capitalizations, e.g. TeStPage. I would like all requests to my domain, in all versions of caps, redirect to that page. I tried a simple: Redirect /testpage http://www.mydomain.com/TeStPage But that crashed my site, because it said 'Non-URL'. How do...

Redirect all page requests to one page

I need to redirect all page requests (php, if that matters) on a specific domain to a specific page (again, php) on that domain. I'm looking for a .htaccess, mod_rewrite solution for easy of implementation. ...

conditional DirectoryIndex in .htaccess

Hi, Is it possible to make the DirectoryIndex value in a .htaccess file conditional based on IP, so that - for example - my IP see's DirectoryIndex as index.html and everyone else sees DirectoryIndex as index.php? Is there a solution other than mod_rewrite? ...

.htaccess / redirecting to https://www.example.com and virtual folder access

Hi, I have a domain example.com. I want users to be redirected to https://www.example.com whenever one of the following is typed: http://example.com http://www.example.com https://example.com I also need to redirect people accessing /asdf (or /asdf/) to /index.php?folder=asdf. I found some examples of code doing the first part, but...

301 redirect is working for www.example.com but not for ....

I am getting a strange problem with 301 redirect it the code is working for with www in the link and not working for with out www RewriteBase / RewriteRule ^api$ http://example.com/topic/api [R=301,L] if i type http://www.example.com/api it works but if i do http://example.com/api it doesnt work Adv thanks prasanth ...

CakePHP + admin routes + .htaccess + production mode

Hi all! The following site shows a (kinda hack-ish) way to protect an admin route with .htaccess: http://snook.ca/archives/servers/password%5Fprotect%5Fadmin/ If I understand it correctly, it only works because CakePHP runs a check for the 'real' file presence before it processes its own URL logic. So, when you request yoursite.com/ad...

How to enable .htaccess in httpd.conf on XP?

I would like to use mod_rewrite() on my apache setup on a windows machine. As you probably know, Windows doesn't use Unix-style hidden filenames like ".htaccess." So should I change AccessFileName .htaccess to AccessFileName xyz.htaccess ? or there is something else I need to do? ...

htaccess redirect from /foo/bar/mydocument.doc to /foo/bar/auth_test.php?q=mydocument.doc

I've got a Web site with a bunch of docs and pdfs in /foo/bar/ Directory browsing is turned off, so you have to know the specific URL/URI combo to get the document. I'd like to find a way of redirecting ALL requests to /foo/bar/ to a php page that checks their auth cookie is set and, if so, gets their file. Of course, I also need the ...

show a list of logged in users through htaccess

We have a protected directory on our site, where users are required to login using the .htacces system. I know we can get the username of the person thats logged in through a PHP variable $username = $_SERVER['REMOTE_USER']; I'm wondering if it's possible to show ALL users logged in? This way we could show something at the top ...

Mod_rewrite htaccess question.

How could I take a URL like http://example.com/page.php?2342 And turn it into http://example.com/page/?2342 or is that not possible? ...

Is it possible to have htaccess if else type rewrite conditions and rewrite rules?

I am trying to write an htaccess file that essentially does this: if(requested file == "some-file.php" || requested file == "some-file2.php" || requested file == "some-file3.php") then Rewrite to redirector.php?uri=some-file.php <- substitute requested file without passing any parameters else // existing rewrite conditions from silve...

how do i fix this rewrite URL rule ?

basically need to convert with www or not, example.com/[anycharacter] into with www or not, example.com/cgi-bin/new-disk.cgi/dir/smooth/[anycharacter] additinoally... i would like to redirect ALL www.example.com into example.com ...

A universal mod-rewrite htaccess file for my script

I'm writing a script that (I hope) will be widely distributed and I want make sure that it will work on as many servers as possible out of the box. This script will require an .htaccess file but I've learned some htaccess files are not very portable. The htaccess needs to do a simple redirect, like so: http://example.com/dir/string R...

how to mask URL with htaccess ?

for example i type in www.myportal.com/cars/ no matter what links i navigate to within this site, i want the address bar in my browser to show just www.myportal.com/cars/ UNLESS www.myportal.com/userpanel. i want the masking to stop when a link pointing to userpanel is clicked. ...

.htaccess redirect problem! All subdirectories to root [SOLVED]

Hello, I'm trying to redirect all subdirectories to the root of my website via .htaccess! The code below works fine if I try to access a subdirectory ... but doesn't let me display the index page in the root because starts a loop of redirects! RedirectMatch temp ^/.*$ http://localhost/ How can I solve? Thanks! EDIT1: Or is there ...

.htaccess mod_rewrite question

If I have a url http://example.com/page.php but I want the page to display when someone goes to http://example.com/page/ how do I go about doing that? ...

Using mod_rewrite, how do I force the path and query string to be all lower case?

This seems like it should be an easy thing to do, but for the life of me I can't figure this out. I want to force my entire URL to be in lower case, so that, for example: http://www.EXAMPLE.com/foo?q=bar http://www.example.com/FOO?q=bar http://www.example.com/foo?Q=BAR http://www.EXAMPLE.com/FOO?Q=BAR all (301) redirect to: http://w...

mod_rewrite, put wordpress in sub-dir on server seamlessly?

I use wordpress for personal blog. Now I want to make it my personal website. Hence, I'd like the URL to be mysite.com rather than mysite.com/blog (e.g. mysite.com/2009/10/blog-entry rather than mysite.com/blog/2009/10/blog-entry) A simple way is to move /blog/* to /blog. But this will make Wordpress files mess up with existing files I ...

.htaccess 301 redirect to homepage if page not found

I have cleaned up my site and discarded lots of pages. I have now 10pages left of a 100page site, all static html. I want any request for deleted pages to 301 redirect to homepage but can't figure out the .htaccess rules! ...

AuthUserFile override for child directory in .htaccess file

I have a directory structure similar to: - html    - sites       - .htaccess    + files    - .htaccess    - index.php The file /html/.htaccess uses AuthUserFile to protect the entire site. However, the /html/sites/.htaccess file is also used to protect the "sites" folder with a separate password. The problem is when I attempt to visit a...