Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

14
votes
4answers
576 views

Removing non-www support

I'm not an advocate of the no-www movement. I like the www because it adds as a buffer to distinguish between our public and private/static sites. The problem is that with one of our sites, our ...
14
votes
5answers
4k views

How can I stop a bot attack on my site?

I have a site (built with wordpress) that is currently under a bot attack (as best I can tell). A file is being requested over and over, and the referrer is (almost every time) ...
13
votes
4answers
647 views

How do I implement URL rewriting in my .htaccess file?

I'd like to do some URL rewriting (Why? See this question.) so that instead of users seeing addresses like labouseur.com/course-compilers.html they can instead see and use simply ...
13
votes
4answers
192 views

What are some resources for learning the ins and outs of .htaccess?

What are resources for learning the various things I can do with .htaccess?
12
votes
2answers
2k views

Is it better to have an ErrorDocument 404 redirect back to the homepage or a standard 404 error page?

We run an ecommerce site that was setup by a third party ecommerce software provider, basic shop with product pages, basket and checkout. The third party vendor set up the htaccess file so that if a ...
12
votes
4answers
2k views

Blocking referral traffic

I am currently getting a massive amount of referral traffic to my site (Spam), that can sometime generate 1-2 GB worth of traffic per a day (which kinda sucks, when you have a 10GB limit from the ...
11
votes
2answers
3k views

Can .htaccess slow down a site?

I'm working with a client on an e-commerce website. I implemented clean URLs using .htaccess. I also used .htaccess to solve canonical issues such as redirecting www to non-www and removing index.php ...
10
votes
1answer
211 views

How are web applications like Tumblr, WordPress.com and Blogspot able to create subdomains for users so fast?

I am curious as to how web-applications are able to create sub-domains instantly for new users, for example, newuser.wordpress.com, or example.blogspot.com. If I need to create a new subdomain for a ...
10
votes
1answer
345 views

301 redirects for all except me

i want to my site down for an hour and i was using order Deny,Allow Deny from all Allow from my.ip.add.ress but i dont like the default error page, is there a 301 redirct where i can redirect ...
10
votes
2answers
748 views

Homemade URL shortener redirect conflicting with 301 redirects

I have a website which was originally built using classic ASP. About a year ago it was rewritten in PHP. This caused file extensions to change and some pages were moved to new locations within the ...
8
votes
1answer
3k views

Alternative to .htaccess (due to bad performance?)

I've been told that .htaccess should be avoided when possible, as it reduces the server performance and new servers disables it or just don't implement it anymore. I don't know how true this is, but ...
8
votes
3answers
4k views

Forcing SSL and www in .htaccess

I'm looking for a way to force SSL and www. I've been able to force both separately but together I keep running into redirection issues. The following code works when handling a URL in this format: ...
7
votes
2answers
220 views

I want to test major changes on my website without hurting SEO

I want to replace all my website files for new ones on the server and to test if they work alright but I don't want to be crawled while this is happening or if I am, I don't want the crawler to be ...
7
votes
1answer
348 views

home page of my site is not appear in google search, when I type site:example.com

I am totally confused, when I place site:example.com in google I see every page of my website in serp(search engine result page) except the home page. I don’t know why it’s happening but I check ...
7
votes
1answer
275 views

Apache rewrite rules for development workstation and server

I've got developers editing pages for several sites on a WAMP stack and then uploading to the public servers running LAMP stacks. We're pretty happy with it, but we have this minor annoyance: we can't ...
7
votes
1answer
2k views

.htaccess redirect url without trailing slashes

In my htaccess I have some rewrited urls like these: RewriteRule ^first-page$ /subdir/page.php?id_page=1 [QSA,L] RewriteRule ^second-page$ /subdir/page.php?id_page=2 [QSA,L] RewriteRule ^third-page$ ...
7
votes
1answer
396 views

Problem with .htaccess and mod_rewrite after moving site to new server

The site seems to draw the correct links but its not redirecting me to the correct view. The same code works fine on the old server here http://ruse.systemio.net/q&a/. The new server is here ...
7
votes
3answers
268 views

How to re-direct Wordpress posts with 301

All my WordPress post URLs generate sub directories with duplicate content and I do not know what regular expression to use to consistently 301 redirect domain.com/category/post/random-number/ to ...
6
votes
2answers
1k views

Allow access to WordPress site only by links in email newsletters

I send out a personal email newsletter, and have been looking into sending it via some service like MailChimp, or sendy.co. Many of these email services suggest, or require, the email newsletter ...
6
votes
3answers
3k views

Where do I create the file .htaccess, in order to serve my HTML5 cache manifest file correctly?

From a post on http://diveintohtml5.org/offline.html (Wayback Machine Copy) Your cache manifest file can be located anywhere on your web server, but it must be served with the content type ...
6
votes
5answers
8k views

How to Remove Extensions From, and Force the Trailing Slash at the End of URLs?

Example of current file structure: example.com/foo.php example.com/bar.html example.com/directory/ example.com/directory/foo.php example.com/directory/bar.html ...
6
votes
3answers
3k views

.htaccess permanent redirect to www

I have a WordPress installation that is not redirecting URLs not starting with www. Example: http://example.com/dir/ doesn't send to http://www.example.com/dir/ instead goes to http://example.com/. ...
6
votes
2answers
23k views

Font blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin'

we are experiencing this error in Google Chrome. We thought everything was set-up correct. But maybe not? Font from origin http://skin.cdn.com has been blocked from loading by Cross-Origin ...
6
votes
2answers
1k views

Redirect/rewrite dynamic URL to sub-domain and create DNS for subdomain

I have created an application in PHP, I would like to re-direct the following URL to corresponding sub-domain. Dynamic URL pattern: http://mydomain.com/mypage.php?user_name=testuser I wish to ...
6
votes
1answer
3k views

.htaccess rule to redirect from 404 to search results

When a user (or a bot) request on non existing page, I want to redirect him to the search results. I prefere to do it with the .htaccess file using something like: ErrorDocument 404 ...
6
votes
1answer
106 views

Restrict access to directories hosting different sites

My hosting provider requires that my primary domain (let's call it example.com) points to my public_html root. I also own several other domains (let's call them exampleA.com and exampleB.com) that are ...
5
votes
5answers
2k views

Should I block agent Wget/1.12 (linux-gnu)?

Is that a scraper? It tried accessing my site which is currently password protected for testing purposes. shall I block it?
5
votes
2answers
6k views

htaccess execution order and priority

Can anyone explain to me in what order apache executes .htaccess files residing in different levels of the same path and how the rewrite rules therein are prioritized? For example, why doesn't the ...
5
votes
2answers
655 views

I am changing my file extensions in URLs, how to keep my good SEO results?

We have a website with good SEO results. For design reasons I have to update the design and I have to change file names from .html to .php. But I keep my domain name! What should I do in order to ...
5
votes
2answers
750 views

How can I disallow access to my website by its IP address?

I want my website to be accessible only by the domain name, not by the server’s IP address. How can I configure Apache to achieve this? Below are the VirtualHost configurations of Apache. ...
5
votes
1answer
16k views

How to pass GET parameters to rewritten URL?

I have an .htaccess rewrite rule like this: RewriteCond %{SCRIPT_FILENME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^search/(.*)$ search.php?q=$1 What this does is, if someone visits ...
5
votes
3answers
237 views

Organizing website files

I want to start creating my website but I have a few questions. http://website.com/directory/webpage - in this kind of website, it does not display a .php or .HTML extension at the end. How to ...
5
votes
2answers
1k views

.htaccess two different rules but only one per time

I'm rather new to the whole .htaccess thing and I'm using the following right now to use 'pretty url's': <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d ...
5
votes
3answers
25k views

How to remove trailing slashes from URL with .htaccess?

The situation Across the entire domain, we'd like the URLs to hide file extensions and remove trailing slashes, independent of the domain name itself (as in, works on any domain). Sample of our ...
5
votes
1answer
940 views

How to internally rewrite a page when requested from specific HTTP_HOST

I have a Drupal site, site.com, and our client has a campaign that they're promoting for which they've bought a new domain name, campaign.com. I'd like it so that a request for campaign.com internally ...
5
votes
2answers
1k views

Is it better to remove old URL from google via webmaster than 301 rewrite?

I have a site which changed from one shopping cart to another. Previously there was an .htaccess file which redirected all the old URLs to the homepage. I changed it to report a 404 for any URL not ...
5
votes
1answer
9k views

Properly force SSL with .htaccess, no double authentication

I'm trying to force SSL with .htaccess on a shared host. This means there I only have access to .htaccess and not the vhosts config. I know you can put a rule in the VirtualHost config file to force ...
5
votes
2answers
2k views

Rewrite rule to show as directory using .htaccess

I want to implement a rewrite rule in my .htaccess file to show a specific url as a directory of my server. See the code below I written, RewriteRule ^(.*)/$ ?page=$1 [NC] This will rewrites urls ...
5
votes
1answer
9k views

How can I use .htaccess to rewrite different domains to different sub-directories, masking the sub-directory?

I have a shared hosting plan that allows unlimited addon domains, but they can only point to the public root (/). I use .htaccess to point different domains to their corresponding sub-directories. For ...
5
votes
1answer
2k views

Redirect from SSL HTTPS to HTTP (NO SSL)

Many of my visitors have bookmarked my site already with https://mydomain.com. Under the bad advice of a programmer I have put my whole site (Joomla) using SSL. I do not sell anything or provide any ...
5
votes
2answers
938 views

URL rewritten pages take much longer to load

(Same issue as http://stackoverflow.com/questions/3987754/how-to-diagnose-htaccess-speed-issues-via-rewritelog but more clearly explained below) We have a site which has scripts like this: ...
5
votes
1answer
926 views

How do I setup authentication on a specific folder using .htaccess?

I have a folder that I want to host files privately on my webserver. How do I go about making it password protected using .htaccess? Note: Nothing monolithic, I want something that is simple/easy so ...
5
votes
1answer
828 views

How can redirect pages from old core PHP site to new Joomla site?

We have our old site into core PHP and we have developed it again into Joomla 1.5 last year (because of some limitations we have to build it into 1.5). Now the problem is the URL of sites changed as ...
5
votes
1answer
845 views

URL masking with .htaccess

I need a hardcore programmer to help me with URL masking. So this is my situation. My website www.michaelfotograf.dk/blog/ is the main site that needs to be configured. I have another ...
5
votes
2answers
968 views

302 Redirect causes garbage at end of Wordpress link in Facebook

When I try to link my Wordpress blog to Facebook, the url doesn't resolve properly. There's garbage appended at the end and Facebook is not able to retrieve information from the site. Happens in ...
5
votes
2answers
1k views

How to 301 redirect from old query string URLs to CakePHP Canonical URLs?

I currently have a .htaccess file that looks like this: RewriteCond %{QUERY_STRING} ^action=view&item=([0-9]+)$ RewriteRule ^index\.php$ /index.php?url=item/%1 [R=301] RewriteCond ...
4
votes
3answers
1k views

How do I block US users from my website without interfering with SEO?

My website uses Apache 2.2.14 (which forwards all requests to Tomcat underneath). I need to block all US users from accessing the website (and potentially users from other countries). But importantly ...
4
votes
6answers
652 views

SEO - which URL's are the best?

I'm using .htaccess with RewriteRule to create SEO-friendly URL's. However, I have a few questions about this: First of all, I noticed many websites end their URL's with .html (or another ...
4
votes
2answers
3k views

URL rewriting removing question mark and replace it with slash

How can I rewrite my URL from edit.php?id=2 to edit/id/2?
4
votes
3answers
670 views

SEO Joomla URL to WordPress URL's

I am trying to migrate from Joomla 1.5 SEF URL's to WordPress SEF URL's. The old links use this formatting: /site/sectionname/categoryname/id-titlename.html I want to migrate it to ...