.htaccess

Why would this .htaccess be stripping out containing folder?

This is from a .htaccess located under /~new/ # invoke rewrite engine RewriteEngine On # force domain.com to www.domain.com RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$0 [R=301,L,NC] When accessing http://domain.com/~new/hello, it is being rewritten to http://www.domain.com/hello The www. is bei...

Using mod_rewrite to convert folders to querystring

What's the easiest way to convert these requests: http://www.example.com/en/ http://www.example.com/en/index.php To: http://www.example.com/index.php?language_id=en There's various PHP files, so the rule would also need to map http://www.example.com/en/anyfile.php To: http://www.example.com/anyfile.php?language_id=en The lang...

htaccess show holding page

Hi I want to show a holding page to outside users but from my machine gain access to the site. Can I do this with htaccess? ...

PHP and htpasswd

I have a structure like this: /home /home/dir1 /home/dir2 Now when someone goes to /home, he is asked for username and password (in a form) and I set session information in PHP for the remaining files of /home. Now /home/dir1 and /home/dir2 are protected by htpasswd but the same username and password. I dont want the user to re-enter ...

.htaccess for IIS?

Is there a way to get URI based access control directly in IIS that works with static content, ASP, WCF services and anything else that comes in looking something like an HTTP request? Particularly I want the access control to be a bullet proof as possible preferably making the decision before IIS even tries to figure out what to servi...

Which files besides .htaccess should I have at a site which uses a domain mask?

I have a site A and site B. Site B has a domain mask to Site A such that contents of Site A are visible at Site B. Site B contains only a .htaccess -file. Do I need other files besides .htaccess at the site B? ...

Is it a security risk not to use a .htaccess file?

I have a Joomla site www.siteA.com and another Joomla site www.siteA.com/siteB. I have a .htaccess -file at siteA, but not at siteB. Is it a security risk not to have a .htaccess -file at siteB? ...

Multiple 301 Redirects after restyling a website (SEO)

We have updated our site recently; the old one had around 300 pages... the new one about 80 ;) This because in the old structure we had, for every argument, many pages. Instead, now we have just one page with a 'summary'. For example, the old structure about the 'car' argument was: Main page, 'cars' sub-page, 'tires' sub-page, 'engin...

.htaccess for rewrite url

hi let me explain in brief. I have a url - "http://Domain.com/FolderName/Default.aspx?EditID=6" with query string. I need to show that url like below "http://Domain.com/FolderName/Name" ...that means I want to remove "Default.aspx?EditID=6" part from url and want to replace it with some name ... Can you help me. Thanks in adva...

How can I use URL rewriting to strip index.php from a URI?

Here's what I need- RegEx to match a url pattern and rewrite it to something else 301 redirect old pattern to new pattern Here's what I have- I have a url pattern that currently looks like this-- http://www.foo.com/press/index.php/2009/4-reasons-to-buy-now/ I want to create a pattern match on the url "http://www.foo.com/press/ind...

Mod_rewrite doesn't work for a url beginning in % (percent sign)

There are several links pointing to a site I manage in which the webmaster mistakenly included a space between the domain name and the page name: www.domain.com/ page.html When the user clicks, this gives www.domain.com/%20page.html I'd like to use mod_rewrite to redirect hits to the incorrect address to the correct addre...

How Can I Have A Conditional .htaccess Block?

This is an Apache question you've probably come across before. I want to have one source package that I can deploy to my workstation, my staging server, and my production server, but for it to load different .htaccess settings based on what the URL was. Note that I was using a kludge with an IfModule call, but that won't work with our ...

Restrict file access to authorized php users

I've inherited an application with a glaring security hole. It has session-based security, but file uploads (which are user specific) are not secured in any way and they are stored in the public file tree. Filenames do not follow any convention as such, making them hard to guess, but the data is sensitive and thus I need to implement ...

How do you simply add new custom rewrites to the .htaccess of a wordpress without fail?

I've added some extra functionality to my wordpress so that I can visit it with a variable and do extra stuff. The problem is, when I turn my ugly dynamic link into lovely permlink formatting in the .htaccess file, wordpress overrides it / ignores it. I've heard there's a way to do it, but the ways I try to do it based off what people h...

Unable to make a 301 domain redirection for a long url in .htaccess

I just moved my siteA.com to siteB.com. I am trying to put traffic from siteA.com to siteB.com. My .htaccess file which 301 redirection does not work RewriteEngine On RewriteCond %{HTTP_HOST} ^www.siteA.com/home/3-Tips-in-Math.html$ RewriteRule ^/?$ "http://www.siteB.com/home/3-Tips-in-Math.html" [R=301,L] How can you make the above...

Unable to make a 301 redirection from siteA.com/* to siteB.com/*

I just moved my site from siteA.com to siteB.com. There are hundreds of articles published in siteA.com. Google finds still only articles on siteA.com. Example of the problem I can find the following articles in Google www.siteA.com/article1 ... www.siteA.com/article777 I need to make make 301 domain redirection from each article a...

Redirect using .htaccess

I want to redirect all user page requests to a page on the same domain. For example, I have an "under construction, BRB" page that I want all users to see when they try to access ANY page on the site. I tried using this: Redirect 302 / http://www.domain.com/index2.php What that does is try to apply the redirect to the index2.php pag...

Cakephp Password Protection with htaccess and htpasswd - howto?

How can I password protect my website during development with htaccess in Cakephp? which htaccess file do I have to change? what do I have to write in the htaccess where do I put the .htpasswd? I searched google for that but couldn't find anything useful, I hope you could help me! Thanks Till that helped me solve the problem! For...

URL Rewriting/Regex Debug

Hi guys, I need a set of fresh eyes on this. I'm having a tough time spotting the problem. In folder X I have an .htaccess file with the following two lines in it: RewriteEngine on RewriteRule ^([A-Za-z0-9\.-]+)/?$ item-display.php?bibid=$1 [NC,L] My interpretation is that anything in that directory will then be redirected to the ite...

RedirectMatch and Regex Tomfoolery

I'm trying to redirect all requests for /library/ to an external URL except when .pdf files are requested. e.g. www.mysite.com/library/section should redrect to www.externalsite.com but www.mysite.com/library/docs/some_pdf.pdf should serve up the PDF file without a redirect. Here's what I have: RedirectMatch permanent /library/!(.*\.pd...