Directory-level configuration file found mostly on Apache web servers
14
votes
4answers
438 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
2k 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
180 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
517 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
...
10
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 ...
10
votes
2answers
2k 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
255 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 ...
9
votes
2answers
566 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
1k 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
4answers
629 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 ...
7
votes
1answer
232 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
246 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
467 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
281 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
226 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
355 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
2k 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
3answers
701 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
3answers
1k views
Force 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: ...
5
votes
2answers
194 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 ...
5
votes
1answer
4k 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
168 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
430 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
5answers
5k 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
...
5
votes
3answers
9k 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
2answers
1k 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
609 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
1k 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
2answers
606 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
442 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
1k views
.htaccess directory to subdomain
I have been trying to make a subdomain from a directory (made by .htaccess) to be used as the main page starting like http://domain.com/sub/2/3/4.html and turning into ...
4
votes
2answers
967 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
5answers
669 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
334 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
2answers
495 views
Redirecting URLs when launching a new website - how to avoid dropping page rank
i have over 100 urls in my website which i need to redirect:
E.g.
/page/how-to-bake-chocolate-cookies/ will redirect to /cookies/how-to-bake-chocolate-cookies/
/page/contact/ will redirect to ...
4
votes
2answers
182 views
Any chance to redirect homepage to a changing permalink without irritating search engines?
We have a php 5.3/Apache 2.2 based cartoon website that always shows the most current cartoon on the homepage (index.php).
Now, a lot of people want to link directly to that cartoon (by copying the ...
4
votes
1answer
266 views
.htaccess and gzip compression
i have question about GZIP compression,
actualy my wordpress website doesn't have .htaccess to be able to use that feature, so can i create .htaccess file only for gzip, it won't change anything on ...
4
votes
1answer
727 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 ...
4
votes
1answer
264 views
Hosting multiple sites - Mask URL?
I have a hosting account where I have my main site (www.mainsite.com points to root folder), and a subfolder xpto.com, where I want to have another site (www.xpto.com).
I can access ...
4
votes
1answer
650 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 ...
4
votes
2answers
685 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 a htaccess file which redirected all teh old URLs to the homepage.
I changed it to report a 404 for any URL not ...
4
votes
1answer
928 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 ...
4
votes
1answer
140 views
Best way to protect public facing development environments?
We're in the process of setting up individualized dev environments for our developers. All of our developers are remote and we don't have a VPN or anything to bring this in house.
But here's the ...
4
votes
1answer
156 views
Do Dynamic Subdomains Harm SEO or not?
I am establishing a new website for just resumes, and I structured my htaccess as to provide dynamic subdomains as:
marketing.resumedomain.org/index.html
sales.resumedomain.org/index.html
...
4
votes
1answer
4k 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 ...
4
votes
1answer
577 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 ...
4
votes
1answer
338 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 ...
4
votes
1answer
2k views
How to write a generic .htaccess file rule, regarding RewriteBase
The following rule in my .htaccess works just fine for routing calls to index.php:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
However, this does not ...
4
votes
2answers
77 views
Restrict access to directories hosting different sites
My hosting provider requires that my primary domain (let's call it domainX.com) points to my public_html root. I also own several other domains (let's call them domainY.com and domainZ.com) that are ...
4
votes
1answer
135 views
How to externally host a mobile website?
I've built a cool mobile website/app using JQuery Mobile. I want to offer that to clients, but I want to use my own hosting.
Here's what I want to do
If a user uses a mobile device to visit ...