.htaccess

.htaccess RewriteRule so user views site.com/folder but is served site.com/f1/f2/f3/folder/index.php

I am trying to figure how to make a .htaccess RewriteRule so a visitor views: site.com/folder but is served site.com/f1/f2/f3/folder/index.php where f1/... is just an arbitrary line of folders. Have kicked mod_rewrite a little, and got some really weird results, none I was going for though. Any help wrapping my head around this is...

How to tell that a folder has been deleted permanently

Hello, I have deleted a folder called forums from my website from 3 months. but in my Google Webmaster Tools it keeps saying that e.g. /forums/member.php?u=1092 is missing (404). is there any way to stop these messages and tell google that i am not going to re-upload it? is this going to affect on my SEO ranking? I tried this code, bu...

Having trouble searching for a '.' using htaccess.

I'm setting up a website that (ideally) would allow users to access other users' homepages with a url in the format "www.mysite.com/Page/ThisLanham" where 'ThisLanham' is the username. The username begins with a letter and can consists of any alphanumeric character along with an underscore, hyphen, or period. So far, the redirection has...

Which headers should I use for serving static content?

I am gzipping my static Javascript and CSS files using PHP. When the original file is requested, the server sends the Last-Modified and ETag headers. I'm not sending these with PHP just yet. I've also seen suggestions to use Cache-control and Expires headers and some more that I don't remember. Are those first two enough? I guess I can ...

htaccess and sessions/cookies

Im having a problem with a htaccess rewrite rule on a site im working on. Main Dir's htaccess: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^website.com [NC] RewriteRule ^(.*)$ http://www.website.com/$1 [R=301,L] This site forces the user to www.website.com, even if they enter the address sans the www. Now i have a wordpr...

.htaccess : allow download of Mercurial archive but only that

Hello, I was fairly happy with my Mercurial setup until now. I use it for personal projects and it is hosted on a shared server at OVH (a French hosting provider). Currently, I have a .htaccess to protect my projects and only allow certain people to pull/push from my repositories. However, I would like to make the changesets archives p...

.htaccess rewritting subdomain + folder to uri

Hi, I want to redirect this: subdom.mydom.com/mydoc TO mydom.com/subdom/mydoc.php Sorry for being too obvious. I know the htaccess rewritting basis but this is making me a little crazy :) ...

.htaccess map a /images to images.blabla.com which is on another host

It is possible to do that, invisible to the users (without redirect) ? I want to save the bandwidth ...

301 redirect - add a slash for index page

How do you set a 301 redirect in .htaccess to add the forward slash to your document root if someone links to you without it? According to the research I have done most search engines consider the following URL's as two different URL's. mydomain.com (no forward slash) mydomain.com/ (forward slash) I've tried this (plus many others): ...

How many files do search engines index per directory

I'm using Apache Mod RewriteRule to deal with dynamic URLs. And trying to figure out the best URL structure to go with. Here are the options I am thinking about: They will all rewrite to: mydomain.com/myprogram.php?username=$1&cat=$2&item=$3 Option 1: mydomain.com/username-category-item-5.html Option 2: mydomain.com/username/categor...

How to insert an "index.php" into every url using .htaccess?

Example: My Site gets called like that: www.mysite.com/controller/method/parameter1/parameter2 Now, .htaccess needs to rewrite this URL into: www.mysite.com/index.php/controller/method/parameter1/parameter2 But the problem is: In case of an img, css or js directory, no redirection should happen. How can I achieve this? What must I...

Why does this RewriteRule cause an Internal Server Error?

I call my site this way locally: http://localhost:80/mysite/de/layer1/layer2/module In .htaccess I have: RewriteEngine on RewriteRule !^((css|js|images)/.*)$ index.php%{REQUEST_URI} [L, NE] I try to rewrite that into: http://localhost:80/mysite/index.php/de/layer1/layer2/module Any idea what's wrong there? EDIT: If I write onl...

Any easy, noncluttering way to set up "mydomain.com/username" using PHP?

Simply put, when a user wants people to be able to go to their profile, we want them to be able to just say go to mydomain.com/username. The real user page would be at something like mydomain.com/users/page.php?id=1325 which doesn't really help users. The problem: I've been doing PHP for some time, and have never had the need to do thi...

Easy mod_rewrite - So I'll never have to think about it again

Not sure how you'll take this question but... Whenever I try to make my URLs look pretty I always end up messing around for too long and it's simply not worth the trouble. But the end effect is good if it were a simple task. So what I want to do is create a method which in the end would achive something like... index.php?do=user&usern...

.htaccess redirect all pages to new domain

Which redirect rule would I use to redirect all pages under olddomain.com to be redirected to newdomain.com? The site has a totally different structure, so I want every page under the old domain to be redirected to the new domain index page. I thought this would do (under olddomain.com base directory): RewriteEngine On RewriteRule ^(....

.htaccess rewrite and subdomains

I have a subdomain setup as onlinedev.domain.com I need to use htaccess to rewrite to domain.com/online_content, while still showing onlinedev.domain.com in the address bar (SSL is for onlinedev.domain.com). this is what I currently have that is very close: php_flag display_errors off RewriteEngine On RewriteCond %{HTTP_HOST} !^$ Rew...

Rewrite To WordPress Page

I have an existing page of /programs/kids.php that I want to load a category page from WP. I want the .htaccess file in /programs to handle this rewriting for me. Something along the lines of: RewriteEngine on ReWrite kids2.php http://www.mysite.com/blog/cat/kids/ Any help would be awesome. ...

Help with .htaccess file's rewrite rule

I apologize in advance if I missed someone cover this already; I tried to see if someone had my own .htaccess dilemma: I currently have the following website: www.example.com I want to set it up like the following: somewebsite.example.com And have the subdomain "somewebsite" point to a subfolder on my root. If that subdomain is not av...

Using referrer to run script

I was wondering if it is possible to execute a script depending on the referrer site. for example if a user accesses my site from Facebook then i want the script to be activated, but if the user accessed the site through google search then the script will not be ran. Is this possible? ...

.htaccess - route to selected desination but change browser url

Problem: I'd like to accept the original request. Say its, /IWantToGoHere/index.php but I want to return to the browser, /GoHere/index.php To be clear: I actually want to send the original request location down to the script requested, however, I want to return the user a browser URL to another destination. Code: RewriteEngine on Rewr...