We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [htaccess]

Directory-level configuration file found mostly on Apache web servers

Filter by
Sorted by
Tagged with
0
votes
1answer
492 views

Force www. on multi domain site and retain http or https

I am using CakePHP which already contains an .htaccess file that looks like: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/...
2
votes
1answer
2k views

=~ (equal-sign tilde) and m“ … ” in .htaccess directive

I saw this bit of code on an old forum post: SSLRequire %{HTTP_HOST} =~ m"\.secure\.powweb\.com" And I was just wondering what the =~ and m" ... " meant. I've been searching online and in the Apache ...
6
votes
1answer
3k 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 ...
11
votes
6answers
8k 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: ...
3
votes
4answers
197 views

Question about mod_rewrite rule for redirecting failing pages

I'm setting up a mod_rewrite rule that redirects failing pages to a custom "Page Not Found" page. This is with WordPress. I've used an online tutorial from the Apache site and so far my rules look ...
6
votes
3answers
14k views

Properly force SSL with .htaccess, no double authentication

I am trying to force SSL with .htaccess on a shared host. This means there I only have access to .htaccess and not the main VirtualHost configuration. I know you can put a rule in the VirtualHost ...
3
votes
7answers
18k views

Blocking all countries except US/Canada/UK

I have a site which is only for US/Canada/UK visitors. I don't want to make it visible to other visitors. I tried to put IP ranges in .htaccess (Deny IP) but it does not work for me. May be I have ...
0
votes
1answer
166 views

How can I work on a WordPress theme already installed in the root directory?

I have WordPress installed at the root level of a website. I thought it would be easy enough to have a "coming soon" page called default.html and edit the .htaccess file as follows: AddHandler php5-...
2
votes
1answer
2k views

Joomla 1.6 URL rewrite on IIS7 (removing /index.php/)

Joomla 1.6 was released today and I'm wondering if anyone knows how to get rid of the /index.php/ part? How link looks now: http://www.example.org/index.php/stuff How link would look after URL ...
1
vote
1answer
1k views

htaccess redirect directories to index.html

I am working on a site where I do not have permission to access the server config and someone else keeps changing the settings. That person just changed the settings preventing users from going to ...
2
votes
1answer
793 views

Redirect before rewrite

Had an issue where I need to redirect old URLs, but not disable the mod_rewrite for page structure. redirect 301 /home.html http://www.example.com/ It needs to live on the Symphony 2.0 .htaccess ...
1
vote
4answers
2k views

How can I redirect %26 in URLs to %2526 using a .htaccess rule?

I would like .htaccess to redirect: example.com/something_%26_else to example.com/something_%2526_else I'm importing a bunch of pages that have ampersands in the title from MediaWiki. These are ...
0
votes
1answer
336 views

Website won't load in Firefox 3.6.13

After the latest version of Firefox came out, I've been having problems with my website. The site is: http://mojheroj.com It works fine in all other browsers, as well as older versions of Firefox and ...
1
vote
1answer
1k views

How secure is using .htpasswd to secure a directory?

I'm basically creating something off of my main domain www.mywebsite.com/intranet. I've created .htpasswd protection for that intranet directory. I can't implement individual user passwords yet and ...
1
vote
3answers
159 views

Simplify URL rewrites in .htaccess?

RewriteRule ^([A-Za-z0-9_\-]+)$ /userviewproducts.php?category=$1 [L] RewriteRule ^([A-Za-z0-9_\-]+)/$ /userviewproducts.php?category=$1 [L] RewriteRule ^([A-Za-z0-9_\-]+/[A-Za-z0-9_\-]+)$ /...
3
votes
2answers
167 views

How to use .htaccess with exclusions

I want all requests on a domain to be redirected to https, with the exception of just one particular file. I'm not sure how to accomplish this with .htaccess -bash-3.2# cat .htaccess ErrorDocument ...
5
votes
5answers
1k 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 ...
0
votes
1answer
166 views

Controlling Access using htpasswd and htaccess

I've got a bit of a peculiar problem on my site. I'm using a .htaccess and .htpasswd file to protect the root of the site. This works great, but when I try to view a video file on my site, it prompts ...
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 ...
0
votes
1answer
182 views

Restrict access of rewriting file using .htaccess

I rewrite my .php files to .htm, using the following code in .htaccess file. RewriteEngine on Options +FollowSymlinks RewriteRule ^(.+)\.htm$ $1.php [NC] This is working fine. But now I want to ...
1
vote
1answer
491 views

One-user databaseless CMS authentication

Background: My client needs a one-user bare-bones content management system, which should be capable to Edit text-content in plain-text or in WYSIWYG-style Possibly create new subpages Update image ...
1
vote
2answers
2k views

How do I force a www subdomain on both HTTPS and HTTP?

For whatever reason I can’t seem to get this right. I’ve looked at many examples on here and on the Apache website. I’m trying to force www.example.com instead of example.com on both HTTP and HTTPS, ...
4
votes
4answers
298 views

How to restrict access to my site using htaccess

How to disallow access to site except me?
3
votes
2answers
3k views

Share on Facebook does not show thumbnail images

I have a PHP application which has a "Share on Facebook" button that, On the development server shows the thumbnail images correctly and allows the user to select between them On the live server, it ...
0
votes
1answer
557 views

Redirecting dynamic pages to static pages URL

I decided to convert all my dynamic pages to static pages URLs. I used to have "/contactUS.php" and now I want the page to be served as "/contact-us". I used to following rule n .htaccess: ...
5
votes
2answers
2k 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 %{...
7
votes
3answers
4k 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/. ...
2
votes
2answers
477 views

Restrict access to web directory with .htaccess

Let me just say that doing this sort of thing with .htaccess files has never been a strong point for me. Let's say that I have a directory in my web root: /dir/data Within that directory let's say ...
3
votes
1answer
482 views

How do I normalise a URL from a folder to a subdomain?

I have a mybb forum hosted at a folder inside my site, which can also be accessed via a subdomain. I would like to configure it so that if someone would enter the folder it would automatically be ...
12
votes
1answer
513 views

301 redirects for all except me

I want to have my site down for an hour and I was using order Deny,Allow Deny from all Allow from my.ip.add.ress but I don't like the default error page. Is there a 301 redirect where I can ...
3
votes
2answers
189 views

Not able to stop hotlink

I am using following htaccess code to stop hot linking my image files Options +FollowSymlinks Options +SymlinksIfOwnerMatch RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://(.+\.)?article-stack....
4
votes
2answers
5k views

How to stop access of a PHP file from other sites

I read somewhere about hot linking of images. Preventing image hot linking helps to stop bandwidth theft from your site. Would it work for a PHP file? In my case, I am using a PHP file to generate ...
1
vote
2answers
897 views

Problem with htaccess causing images not to load

In my htaccess file, i am using below lines Options All -Indexes Errordocument 403 http://article-stack.com/ ErrorDocument 401 http://article-stack.com/ ErrorDocument 403 http://article-stack.com/ ...
3
votes
2answers
1k views

How to hide awstats url parameters

currently in order to access statistics on my site I access this link: www.example.com/awstats/awstats.pl?config=awstatsconffile.org all is working fine, but what I want to achieve is simply this: ...
3
votes
2answers
125 views

file need to go through a php page using .htaccess

I'm looking for a way to convert this type of URL: http://www.example.com/dl/F5EGD6 Into http://www.example.com/dl/files/my_file.zip using a PHP page to request the URL from the DB with F5EGD6. I ...
5
votes
2answers
2k views

URL rewritten pages take much longer to load

(Same issue as https://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: http://...
2
votes
1answer
1k views

What are the AllowOverride settings if you're hosted on GoDaddy?

I'm looking for the AllowOverride setting for GoDaddy hosting, does anybody know where I can find that?
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 ...
3
votes
2answers
358 views

How can I rewrite an old URL using variables to a static html page?

I am trying to redirect old URLS to the new URLS, the old site used variables in the URL but the new site uses SEO friendly URLs. When I try to redirect the old URL, it is not redirecting correctly ...
3
votes
3answers
1k views

Will googlebot index my index.php even with an htaccess redirect?

Using a redirect statement in my htaccess file, people who type the following into the address bar... http://example.com/index.php ...are redirected to... http://example.com/ I also have a noindex,...
15
votes
2answers
3k 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 ...
3
votes
2answers
965 views

Apache RewriteRule not redirecting

I have this in my .htaccess file: RewriteEngine on RewriteRule ^images/chart\.png$ /static/images/chart.png [L,R=301] RewriteRule ^images/artwork/(.+).png /static/artwork/$1.jpg [L,R=301] #...
8
votes
1answer
411 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 http:...
15
votes
4answers
645 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
5k 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) turkyoutube.org/player/...
7
votes
1answer
304 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 ...
13
votes
4answers
208 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?
5
votes
2answers
1k 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 ...
17
votes
4answers
764 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 labouseur.com/...
7
votes
4answers
15k 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 example.com/cgi-bin/directory/...