.htaccess

HTACCESS complicated query

Hey! I have this question about HTACCESS. I know how to do a 301 from all lowercase to all uppercase and vice versa but I'm confused with this one. I want to do a 301 redirect via HTaccess. The pages I have look like www.mysite.com/James or www.mysite.com/Paul I want pages like www.mysite.com/JAMES or www.mysite.com/james or www.mysi...

User hits mouse back button - browser ignores cache settings?

I need to make sure when the user hits back with, for example, the mouse, the browser doesn't instantly load the page from the cache and instead runs the associated code again. This is what my .htaccess looks like. It appears to be just Firefox that is ignoring the cache settings. <IfModule mod_expires.c> ExpiresActive On # Expir...

.htaccess (Apache mod_rewrite) RewriteRule to match email adress?

Hi! I want to make a rewrite rule from edit/[email protected] to [email protected] : RewriteEngine On RewriteRule ^edit/([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$ edit.php?email=$1 [NC,L] ~ where [\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?) is t...

URL redirect for user profile in .htaccess

Can you please tell me how I can redirect the url like www.santaraj.com/steve to a new my file profile.php? Actually I want to display the user profile by profile.php but the url will remain as domain name/username (www.santaraj.com/steve). A good example is www.twiiter.com/kk. ...

Which mod_rewrite rule can remove index.php and php extensions (from another existing rule)?

I use the following pattern: http://example/index.php?lang=en http://example/index.php?lang=es http://example/index.php?lang=zh-tw http://example/index.php?lang=zh-cn And I use the following mod_write rule: RewriteEngine on RewriteRule ^([a-z]{2}(-[A-Z]{2})?)/(.*) $3?lang=$1 [L,QSA] With that rule I can use the following URLs which...

custom 404 error htaccess

I am trying to create a custom 404 error on my website. I am testing this out using XAMPP on a windows machine. My directory structure is as follows: error\404page.html index.php .htaccess The content of my .htaccess file is: ErrorDocument 404 error\404page.html Which produces the fllowing result: However this is not working -...

Using mod_rewrite to serve mobile version of a page

I'm trying to add an optional mobile layout to an existing website. Under certain circumstances, I'd like to be able to serve entirely different content for the mobile version than for the same page on the regular version. If the user visits, say, m.example.com/food/apple.html, he'll see an entirely different page than for example.com/...

How long is too long for an .htaccess file?

I wonder if my .htaccess file is too long/inefficient? I have about 250 lines of rewrite rules like: RewriteRule ^(en|de|fr)/foobar$ ?site=foobar&lang=$1 [L] RewriteRule ^(en|de|fr)/foobar/bar/123$ ?site=foobar&value=bar&othervalue=$2&lang=$1 [L] Is there a way to do it more efficiently? ...

Is it possible to use http_refer to block direct access to a folder while allows a flash player access

I have mp3 files on my server that I want to be accessed via a flash player on my site. Is it possible to use http_refer to do this as suggested by a close colleage? Based on my research, I kept coming across the code below but that blocks everything including my flash player. How do I only allow my flash player to access the files wit...

Using htaccess to serve sitemap from a remote server

Hi is it possible to display my sitemap from a remote server like its residing on a main server say mydomain.com/sitemaps/filename.xml will get its content from remoteserver.com/sitemapts/mydomain-sitemap-filename.xml and how do i do it in htaccess. Thanks.. ...

Need regex to match two rather similar URL patterns

Hello all, I need a regex (to be used in .htaccess) with the following attributes, capturing the four-digit number and the text following it: Match: /9876/text_text_more_text_still_more_text /8765/1234_text_text_text Do not match: /2010/08/01/text_text_more_text_still_more_text /2010/08/01/text-text-more-text-still-more-text So far I...

How to redirect a subdomain in htaccess that has no subdirectories

I have searched on google and stackoverflow for a while, but didn't really found an answer to my question. I want to redirect admin.domain.com to www.domain.com if there are no subdirectories or queries. Examples that should redirect: https://admin.domain.com http://admin.domain.com https://admin.domain.com/ Examples that shouldn't re...

Rewrite rule for apache htaccess that checks for existence of certain GET params

Hi, I just can't find a solution to this... I have several dynamic page links that look like http://DOMAIN/PAGENAME?&amp;param=a/param2=b&amp;tx_ttnews[tt_news]=114&amp;param3=c No I want to have a rewrite for certain "tx_ttnews[tt_news]" values, i.e. if it exists (or certain other numbers) I want to redirect to a completly different ...

Htaccess 301 only part of the redirect works

Hi Im moving a site from one domain to another, and I have created the following .htaccess file, but its not working. *#Options +FollowSymlinks RewriteEngine On redirect 301 http://www.el-netshop.dk/pi/Dækkape_UG150_12_lysegrå_5302_.aspx http://www.el-netsalg.dk/pi/Dækkape_UG150_12_lysegrå_5271_.aspx RewriteCond %{HTTP_HOST} ^el-netsho...

how to redirect URL in PHP using .htaccess?

hi all, how to redirect a url in php? if i use htaccess to redirect, then its asking me a authentication (username & pwd). i want to redirect to url without any authentication. is it possible in php. i dont want to use headers or meta tags or window.location to relocate i.e redirect. any other way is possible? thanks in advance. ...

redirect https:// to http:// bypassing the "Add Exception" page

For some reasons Google custom search result shows https:// for some of my page links. The only solution for now would be to redirect the https:// links to http:// with htaccess for now until i figure out why search results are showing https:// I want the redirect to bypass the SSL cretificate or "Add Exception" page and redirect to htt...

Security issue with wordpress website - htaccess

Now I didn't do the website design but a couple of months ago I ported an existing website over to wordpress for a client of mine. I got a call from a client today regarding their website, and some sort of a security problem. The websites homepage loads up fine, but if you try to navigate to any other page it brings you to - http://sec...

.htaccess deny acces to all except to one file

How can i deny access to a complete folder and sub-folders, with the exception of one file? That file is: toon.php and resides in the same folder. ...

How to Detect and Redirect from URL with Anchor Using mod_rewrite/htaccess?

I've seen a number of examples of the opposite, but I'm looking to go from an anchor/hash URL to a non-anchor URL, like so: From: http://old.swfaddress-site.com/#/page/name To: http://new.html-site.com/page/name None of the examples at http://karoshiethos.com/2008/07/25/handling-urlencoded-swfaddress-links-with-mod_rewrite/ have fun...

How do I prevent direct access/download to mp3/wav files while allowing a flash player to access them with .htaccess (or PHP)

I've been scouring the Net for hours looking for a solution with with only partial and non-functioning solutions to show for my efforts. The solution below seemed like a great fix at first but it also blocks my flash player from accessing the files. Could I only allow access from particular pages?: < Files ~ "..."> order allow,deny den...