.htaccess

protecting my web page and folder from external using .htaccess and .htpassword in php

Hai I want to protect a folder (protect) and the files inside that folder. I have created a .htaccess file and put the following code. AuthName "Myfolder" AuthType Basic AuthUserFile url/protect/.htpasswd Require valid-user Also created a .htpassword file which contain username:password When I run my URL http://localhost/url/protect...

Efficient Method for Preventing Hotlinking via .htaccess

I need to confirm something before I go accuse someone of ... well I'd rather not say. The problem: We allow users to upload images and embed them within text on our site. In the past we allowed users to hotlink to our images as well, but due to server load we unfortunately had to stop this. Current "solution": The method the program...

convert clean url to normal url by mod_rewrite php

Hai I have worked with clean URL in php. Now I want to convert a clean URL to normal php URL Like http://localhost/url/user/2/a to http://localhost/url/user.php?id=2&sort=a Can any one give me the way to do this? also i have one more question. Is there is any way to do this with out .htaccess? ...

Problem with .htaccess (mod_rewrite). RewriteRule's doens't work correctly

Hello, I have a problem with my two RewriteRules. .htaccess: # protect the htaccess file <files .htaccess> order allow,deny deny from all </files> RewriteEngine On Options +FollowSymlinks Options -Indexes RewriteBase /test/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^download/([0-9]+)$ dow...

.htaccess and MP3s

I'm trying to restrict access to MP3's to users only (i'm using wordpress) I have my .htaccess set up to redirect back to the homepage unless you click it - to prevent people just typing in the url. But when a registered user does click it the MP3 doesn't stream (in safari) and when you try to 'download linked file' you get a html fi...

htaccess rule for redirection of any particular name to particular page

I am using PHP and I need to use a name say "Pranav dave" in url which should redirect me to "myprofile.php" what should i do?.. also the url should display me "Pranav dave".. and what should be the htaccess rule to redirect any html file to php file? ...

Need to redirect to true root folder

I am running a website on MAMP, and the root is http://localhost/sandbox When I have links that link to, for example - /calendar it directs them to localhost/calendar, I want it to redirect to localhost/sandbox/calendar What would I have to do in htaccess to get it to redirect everything to localhost/sandbox/ as the root? ...

.htaccess code (protect access directly)

Hi. I have a SWF file in my server that i want it can read a text file (sample.txt). but i don't want others access it directly waht is the .htaccess code for it ? Thanks... ...

Redirecting using 301 rule in .htaccess

I am having a problem with redirecting a page from example.com (to) www.example.com The code I have is: RewriteEngine on RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$ [NC] RewriteRule ^(.*)$ http://www.subdomain.domain.com/$1 [L,R=301] And it is not working, any help? ...

Deny access to all files (and in subdirectories) except 2 and 2 folders

How can I Deny access to all files (and in subdirectories) except index.php and phpinfo.php (in root) and images and documentation (folders) Using .htacces? ...

Prepend 'www' to an HTTPS url using .htaccess & mod_rewrite

I have a dilemma with this one. With the following code I am able to force SSL on any non SSL url, however when the user (and results from Google) take the user to http://mysite.co.za then we hit an issue as the url is then rewritten to https://mysite.co.za Due to the fact that my certificate is bound to www.mysite.co.za it immediately ...

redirecting www.subdomain.example.com to subdomain.example.com

I've had some users trying to access a site that is registered as subdomain.example.com with www.subdomain.example.com. is there some sort of .htaccess rule I can add to redirect people that arrive using www.subdomain.example.com to subdomain.example.com? Also, do I have to change DNS stuff? ...

Using - Instead of + in WordPress Search Permalink

Options +FollowSymLinks RewriteEngine On RewriteCond %{THE_REQUEST} ^[A-Z]+ /(#[^?& ]*)??([^& ]*&)?s=([^& ]+)[^ ]* HTTP/ RewriteRule ^$ http://wordpressblog.com/search/%3? [R=301,L] Currently I use the above .htaccess mod_rewrite rule to convert default WordPress search permalink: http://wordpressblog.com/?s=key+word into nice per...

Complex .htaccess rule help

I'm struggling to write a .htaccess file. I need to redirect addresses such as: /archives/YYYY/MM/post-name to /blog/post-name Any help would be appreciated! ...

Redirect all traffic but "beta" sub-domain to Splash screen (mod_rewrite)

Hi, I'd like to redirect all my traffic to my root domain, the root domain being a Splash screen. I'd like to do this ONLY when the %{HTTP_HOST} is not beta.example.(com|es|fr). So I've tried the following in my .htaccess file, with no luck... (infinite loop... I guess it's not getting the REQUEST_URI condition, but cannot figure out w...

rewrite .htaccess for a link like http://DomainName.com/UserName

Hello, I want to do a .htaccess rewrite, which when users enter this http://DomainName.com/UserName should go to http://DomainName.com/UserDirectory/UserName, but should show http://DomainName.com/UserName to the user Thanks Jean ...

mod_rewrite htaccess redirect on specific request

is there a way to make mod_rewrite redirect all urls contain the following request: ?do=page&f=* to a specific page? for example: http://example.com/index.php?do=page&amp;f=2 http://example.com/index2.php?do=page&amp;f=4 http://example.com/page.php?do=page&amp;f=22 to: http://example.com/custom.php ...

Even more advanced .htaccess question

Got a great answer earlier, but unfortunately, I didn't explain the WHOLE situation: I need to rewrite: blog.domainname.com/archives/YYYY/MM/postname/ and www.blog.domainname.com/archives/YYYY/MM/postname/ to www.domainname.com/blog/postname/ Thanks in advance! ...

SEO Friendly URL to Dynamic URL using PHP

Currently I have a url like this http://&lt;client_name&gt;.website.com/index.php?function_name&amp;cat=32 I want to set things up so that our Marketing people can publish url's like http://&lt;client_name&gt;.website.com/&lt;parent_category&gt;/&lt;category&gt; The "cat=XX" will be generated of the last <category> only. But m...

.htaccess redirect question

I have a slight problem with .htaccess redirect. I have a dynamic site with 2 levels of variables - content="type -(alpha)" and ID="number" but this is very not seo friendly what I really would like to create is a rewrite rule that generates a "friendly" url for serach engines & users alike. Very much like WordPress does. Each ID is a...