Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

2
votes
2answers
65 views

mod_rewrite ignore Stylesheet and JavaScript

I have a mod_rewrite to allow example.com/location as example.com/?page=location RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} !^page RewriteRule ^(.*)/?$ /?page=$1 [L] But how do I ...
3
votes
1answer
277 views

.htaccess syntax multiple RewriteEngine on

I'm learning to maintain my own WP site. After a lot of reading I ended up with my "complete" htaccess file that looks something like this DirectoryIndex index.php # Disable directory listings ...
0
votes
0answers
5 views

Excluding a file from an IP block [duplicate]

I have recently converted a pre-2.4 configuration to Apache's new authorisation configuration but ran into a problem/misunderstanding concerning more than one RequireAll block. What I am basically ...
2
votes
0answers
87 views

RequireAll blocks overriding each other

I have recently converted a pre-2.4 configuration to Apache's new authorisation configuration but ran into a problem/misunderstanding concerning more than one RequireAll block. What I am basically ...
2
votes
1answer
44 views

My subdomains to a folder won't work

I'm trying to host a WordPress network. Though, the network doesn't work with the built-in WordPress subdomain redirection, that's why I create directly the subdomains at my host (legtux.org, a free ...
2
votes
3answers
170 views

How to avoid MP3 downloading sites from using my files?

I have a WordPress site where I'm gonna host files such as MP3s. The thing is I know if I don't do anything, MP3 Crawlers like mp3glu or mp3pleer will come and use my files and bandwidth, which I don'...
2
votes
0answers
41 views

Separate multiple domains with htaccess (solution works on one hosting, not on another)

I have two different domains on one VPS. It's Apache 2.4.7, I remember trying long to set up name based Virtualhosts on localhost to find out Apache Virtualhosts are not supported anymore. (I cannot ...
1
vote
1answer
14 views

how to prevent load image on special sites [duplicate]

how to prevent load my website images on special sites because many websites hotlink my website images How to Detect and Stop Image Hotlinking on my Website thanks
2
votes
2answers
73 views

How to change whole folder from http to https

The checkout/onepage is working with HTTPS. But, why checkout/cart is not? Here is fragment of the .htaccess: ############################################ ## enable rewrites Options +FollowSymLinks ...
1
vote
3answers
49 views

Regular expression for Apache redirection

In the .htaccess file I would like to redirect (301): From: http://www.example.com/photo<anything> To: http://www.example.com/blog/ Basically, any URL starting with /photo should be redirected ...
1
vote
1answer
52 views

Google not updating title with htaccess expires

It's been 2 weeks I've changed my website title and still Google hasn't changed the title in search engine. I think it's because of if modified since header... my website is generating 201 OK status ...
2
votes
2answers
179 views

Forcing HTTPS and WWW with apache

Apache does not force HTTPS in a subfolder of a folder, but it works in the first level subfolders. Here are all the HTAccess snippets I have tried: RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"' ...
2
votes
2answers
87 views

Redirect to non-www and non-https in htaccess

I need to redirect my WordPress blog from https://www.example.com/blog to http://example.com/blog using the .htaccess file. This is what I have so far: <IfModule mod_rewrite.c> Options +...
1
vote
1answer
52 views

Use .htaccess to convert user ID's to usernames? [closed]

I want to use .htaccess to convert the urls that link to profile pages from an ID number to a name. For example, on Facebook, if you were to go to: https://facebook.com/profile.php?id=4 It would ...
2
votes
1answer
207 views

Multi-language site, landing page

Couldn't find a similar question here, and seems kinda simple, so sorry if this has been asked before. I'm developing a site with dual language, setup in the following format: http://www.example.com/...
-1
votes
2answers
158 views

How to set execute-only permission for a php script in a .htaccess file?

I'm really a newbie in web-technologies, so this question may be silly. I have a php script that accesses a database, therefore it stores a database password (tell me a better way to store this ...
1
vote
1answer
37 views

How Do I Remove A Subfolder Using Htaccess?

I am trying to remove /view from example.com/businesses/view so you can go to example.com/businesses and it works correctly. Here's what's in my htaccess already: DirectoryIndex index.php RewriteBase ...
1
vote
2answers
133 views

How to deny direct access to font files used in CSS?

I have a website that displays texts with unique, copyrighted fonts. I use a CSS file with "font-face" elements (see the example below) and I store the font files in a folder called "type". I would ...
1
vote
1answer
56 views

PHP webpages in sub-directory cannot be accessed

I've got a university club website at thing.uni.ac.uk/meow/foobar which also has the domain foobar.co.uk. I don't have access to the config. I set up this website using HTML/CSS/JS alone and it's been ...
2
votes
2answers
80 views

Need .htaccess mod_rewrite for serving static content from subdomain, but forcing www otherwise

I have a website where I currently force example.com visits to www.example.com, and it has an SSL certificate, so I also force HTTP to HTTPS. My SSL certificate covers example.com and www.example.com. ...
6
votes
1answer
158 views

.htaccess rewrite url leads to missing css

I am trying to make my url from this: www.domain.com/view.php?id=15 To ths: www.domain.com/watch/15 My code in htaccess is as follows: Options -Indexes Options +FollowSymlinks ...
3
votes
1answer
103 views

After rewriting URL page not found

I want to rewrite my current URL that is http://localhost/sitename/landing-page/?from=Algeria&to=Afghanistan&submit=Submit to http://localhost/sitename/removals-from-Algeria-to-Afghanistan ...
1
vote
0answers
43 views

Problem with http to https redirect

I have the following .htaccess file (in www.example.com/folder1/folder2) RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] to map any HTTP request ...
1
vote
0answers
73 views

URL masking to subdomain redirecting to subdomain

I am trying to change the URL of a Joomla site in browser my original URL is like example.com/marketsite/abc and I want to change it to abc.example.com/marketsite/abc I am using following code ...
9
votes
3answers
1k views

Can the files robots.txt and sitemap.xml be dynamic through an .htaccess redirect?

I have a multilanguage and multidomain site. It runs through a unique CMS installation (Drupal), so I have a single root directory. So if I have a static robots.txt, there I only can show the files ...
0
votes
1answer
48 views

fail2ban logs IP address trying to access server, enough?

I have fail2ban and logwatch set up. There are IP addresses that are banned > 20 times every day for trying to brute force (I assume) access the server. I have added these IP addresses to the ....
4
votes
2answers
458 views

redirecting https to http

RewriteEngine on RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301] # WordPress Defaults RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} ...
1
vote
2answers
71 views

Why are my Google Analytics pageviews and sessions down?

I am running a WordPress site. Up until October 1, the site had a blog running at the root level of the site. On that day, I moved all the blog files into a directory so the WordPress blog would be ...
4
votes
1answer
314 views

Too many redirects due to htaccess code

TL;DR: What does the following line of code do? Does it remove trailing slashes from a URL? RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L] I inherited a Drupal site with little knowledge ...
0
votes
1answer
16 views

Redirect a set of dir to single page

Suppose I have example.com and removed 5 directories.They consist a lot of URL.Because I give penalty from google search engine, I decide to create a page and redirect (permanent 301) those to my page....
0
votes
0answers
17 views

Redirection rule not working in .htacces [duplicate]

I have added the following rule to .htaccess RewriteCond %{HTTP_HOST} !^example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.example.com/$1 [R=301,NC,L] I ...
4
votes
1answer
659 views

redirecting openshift rhcloud domain to custom domain for SEO purposes

Openshift application url: example.rhcloud.com Custom domain: example.com I came across this link and added the redirection rule. However, I can not access example.rhcloud.com now. My custom domain ...
4
votes
1answer
342 views

Redirect and removing question mark on URL using htaccess

When I access my site using www.example.com/blog it redirects to example.com/?/blog. How can I remove the question mark, so that the redirection just goes to example.com/blog? My current .htaccess ...
1
vote
0answers
94 views

Random domain pointing to my domain

A random person has pointed their domain to my website. I don't have much experience with websites, but I know a bit. What can I put in .htaccess to give a 403 error if they try to access from a ...
0
votes
2answers
61 views

Non-www to www Redirects

I'm trying to redirect my main domain non-www to www but I have this error; my add on domain redirects like this: http://www.example.org/example.org/ How can I redirect my main domain without ...
2
votes
1answer
38 views

Conflicting mod_rewrite rules

The Background I run a university club website which has multiple domains, let's say meow.co.uk, foo.uni.ac.uk/bar/meow/ as two relevant cases. (When I upload files using an FTP client, it's the ...
2
votes
0answers
62 views

What strings do %{HTTP_HOST} and other mod_rewrite variables return? [closed]

If I have a htaccess file that has RewriteCond %{HTTP_HOST} in it, what is the HTTP_HOST? This is something I've been struggling to find out. To help me understand, could you tell me, in each example ...
1
vote
1answer
104 views

How to set up a rel=canonical in PHP?

I'm trying to add the rel=canonical tag to only one page. In order to add the tag, I need to add it to the part, in the mod_header.php file. This will add the same rel canonical tag to all the pages ...
4
votes
1answer
100 views

.htaccess rewrite when site has multiple domains

I run a university club website which has two three (update: I have recently discovered the third) domains, let's say www.meow.co.uk, foo.uni.ac.uk/bar/meow/ and uni.ac.uk/bar/meow. I'm using the ...
4
votes
2answers
756 views

htaccess ErrorDocument 500 not working

I have a site whose .htaccess file contains: ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html The 404 redirect works just fine, but when I encounter a 500 Internal Server Error,...
1
vote
1answer
217 views

Only use HTTPS for main site and HTTP for subdomains

I have a few static files on a i. subdomain but I don't have an SSL certificate and for its use it doesn't need one, however when I try to access it - it redirects for https which throws up an error ...
4
votes
1answer
181 views

How do I tell a directory that all files inside should be treated as a PNG?

I have PNGs in which for instance they are named "5021" rather than "5021.png" and for some images it is fine and displays like a normal image but others download automatically; I was told by someone ...
1
vote
1answer
230 views

How to redirect the root of a directory in .htaccess without also redirecting all the contents?

I have two specific URL which are being redirected with 301 redirect in my .htaccess file like below: redirect 301 /old-url-1/ http://www.domain.com/new-url-3/ redirect 301 /old-url-2/ http://www....
1
vote
0answers
44 views

How to Exclude URL From PageSpeed Modification

I am currently working with the PageSpeed module and one of the URLs it is modifying I need to restrict. Here is the page I am looking at but it does not seem to have the solution for restricting the ...
0
votes
0answers
20 views

Seo-wise way to remove a portion of website [duplicate]

I have a website with 5000+ products driven from a MySQL database, so far so good. My links are friendly structured; http://www.example.com/brand/product/ About a year ago, I decide to add reviews ...
0
votes
1answer
149 views

Remove www and force https [duplicate]

This has been asked multiple times, but none of the answers have worked for me. I have just installed an SSL certificate and need to force https connections for all visitors. This site has a lot of ...
1
vote
2answers
266 views

htaccess ErrorDocument 404 not working

I am planning to replace WordPress on my site with custom HTML/CSS/JS, and I'm trying to check my .htaccess file will work. It is working, as I was able to change the directory index with it, but for ...
0
votes
1answer
26 views

Rewrite rule for url that's different than directory structure

We have a a site that has a url like such: http://www.example.com/sample Internally on the server the directory structure is like this: /site-specific/www.example.com/sample The htaccess looks ...
1
vote
2answers
43 views

Using .htaccess to get content from directory for sub-domain

I've read a tonne of questions on this and tried a few solutions, but I'm just not getting the results I want. I'm currently using: RewriteEngine on RewriteCond %{HTTP_HOST} ^cp\.example\.net ...
0
votes
0answers
61 views

htaccess www to non-www and non-SSL to SSL [duplicate]

I want to redirect all HTTP requests to HTTPS as well as redirect all www requests to non-www. The reason for this is that I want SSL to be forced and I am currently unable to support SSL on my www ...