Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

14
votes
4answers
534 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
3k 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
622 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
190 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
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
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 ...
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
322 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
670 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
2k 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
3k 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
211 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
314 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
270 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
1k 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
365 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
258 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
865 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
7k 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
2k 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
1answer
2k 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 ...
5
votes
5answers
1k 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
637 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
2answers
531 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
1answer
10k 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
228 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
810 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
18k 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
885 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
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
2answers
962 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
7k 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
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 ...
5
votes
1answer
1k 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
819 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
100 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
1answer
869 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
639 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
662 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
833 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
617 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
2k 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
2answers
646 views

Difference between “/” at end of URL and without “/” [duplicate]

Possible Duplicate: Does it make a difference if your url ends in a trailing slash or not? Why treat these as different URLs? I am doing a 301 redirect in my WP application using ...
4
votes
5answers
842 views

Site compromised .htaccess files everywhere

Some of the sites we're hosting are compromised by... I don't know what. Every directory on the webserver contains a .htaccess file which redirects a user coming from a search engine to a page which ...
4
votes
2answers
109 views

Prevent Google from listing hotlinked images for other sites

I am hosting several domains on my server and hotlink images accross various domains. However, I have found out that in Google searches, the images are listed as originating on the site where the ...
4
votes
1answer
83 views

How can I serve all resources under HTTPS instead of HTTP without changing their URLs in the HTML code

I know that by using an .htaccess file I can redirect everyone to https://. However, my SSL certificate complains if all the content isn't served under HTTPS. Is there a way to convert all the ...
4
votes
2answers
182 views

One million redirects

What's the best way to redirect 1,000,000 unique URLs to another 1,000,000 unique URLs? These pages are all combinations of multiple search filters and queries. We're migrating the site to cleaner ...