New answers tagged

0

You have a few fundamental problems with your last line. RewriteRule ^/?$ "http\:\/\/10\.10\.10\.10\:8080" [R=301,L] Change it to: RewriteRule .* http://10.10.10.10:8080 [R=301,L] Of course, I assume that the IP address 10.10.10.10 in your example is just an example and that you are not trying to redirect to a private IP address that is not routable. ...


1

What you are referring to is a "front controller". The usual first step is to make sure that the resource being requested is not a physical file on the filesystem before rewriting to your front controller (ie. your Perl script). For example, using mod_rewrite in your root .htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{...


1

RewriteRule portfolio portfolio.php RewriteRule reportage reportage.php Sorry, just realised what's going on... you need to be more specific in your rewrites. The above rules will rewrite the URL if "portfolio" (or "reportage") appear anywhere in the requested URL - this will catch your image URLs as well (since "portfolio" and "reportage" are part of ...


0

I changed name of my folders to not conflict RewriteRule 's Ex. Have reportageImages---> my .jpg here now its imagesR - name doesn't matter but it was in conflict someway with that RewriteRule: RewriteRule reportage reportage.php Now it works.


0

Just implemented this for my site. Works like a charm! Added to the top of my .htaccess file. Redirects all instances of people typing www or not www, http or https. # BEGIN HTTPS Redirect RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] # END HTTPS Redirect


1

RewriteRule ^$ /temp [L] If you have a physical directory temp in the root of your filesystem... and since you have omitted the slash from the end of the RewriteRule substitution then mod_dir will attempt to "fix" the request by appending a slash. It does this by issueing a 301 redirect. (You are then presumably relying on the DirectoryIndex to serve the ...


1

ANSWERS: My web host made changes, activating "DirectoryIndex". Yes. Just add "Options -Indexes" to .htaccess file. No. SHORT EXPLANATION: This is an apache functionality called "DirectoryIndex". If this is activated, when: a directory url is requested (e.g. www.example.com/assets/); and no index file exists, the apache server creates an index file ...


1

Maybe try something like this: RewriteCond %{HTTP_HOST} !^oldsite.com$ RewriteRule ^/?unchanged/url - [L,QSA] RewriteCond %{HTTP_HOST} !^(www\.)?newsite.com$ RewriteRule ^(/?specific/page) http://newsite.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(www\.)?newsite.com$ RewriteRule ^ http://newsite.com/ [R=301,L] The order is the important part. First, ...


1

The easiest way to do this isn't with rewrite rules but with the redirect directive. Simply use Redirect 301 /oldfile.htm http://example.net/newfile.htm in your .htaccess file to redirect a single file from the current site to a file on another domain.


0

What both @Aakash and @w3dk state in their comments is important. When using .htaccess to enable friendly URL's you have to first make sure that you actually have access to the .htaccess file on the server, then you need to make sure your server is configured to support .htaccess for URL rewrites (most cPanel and Plesk servers are). After the .htaccess file ...


0

Whether this will work or not really depends on the method used to hack your site. If the attackers where able to gain remote access to your server then there is no real way to prevent later changes to files after they have been uploaded. If the attack vector is through WordPress itself then you can restrict the file permissions for WordPress to the minimum ...


1

You can do this without using .htaccess at all. What you need to do is define a wildcard DNS record directing all queries on the subdomains to your application server. The using whatever language you are developing in you would check the host header (fully qualified domain name) to identify the user being requested. Then as part of your application code if ...


0

Anything you do to handle authentication even if it is a static site will still become somewhat dynamic simply from the need to have a database backend for authentication, which in turn means more than likely the trade-off of using the database to power the page content as well. What would best suit your needs here is a content management system. There are a ...


0

Based on @AgA's comment the problem was to do with the sitemap. To explain this for other users who may come looking... As part of the sitemap standard the URL needs to be within the exact same domain. So when the sitemap was copied across to the new domain but was still pointing to the old domain's pages the pages on the new domain where not being indexed ...


3

RewriteCond %{REQUEST_URI} !^/Joomla3 RewriteRule ^(.*)$ Joomla3/$1 [L] What these directives do is... if the requested URL does not start "/Joomla3" then internally rewrite the request to the "Joomla3" folder. What you need to do is add another condition to state that... if the requested URL does not start "/Joomla3" and it does not start "/owncloud" ...


0

What you are trying to do would be easier at the application level instead of the .hhtaccess level. What you could do is create a single application hosted on the server and each user has a dns record pointed to that application... eg: application is hosted on server 1.1.1.1 DNS config is... app-server IN A 1.1.1.1 user1 IN CNAME app-...


0

Doing it through a .htaccess file while theoretically possible can cause issues and so many shared web hosts prevent that directive in .htaccess. However depending on the hosting panel they are using you may be able to specify the PHP version to use using the hosting panel itself. Both cPanel and Plesk have the ability to specify the PHP version to be used ...


1

DirectoryIndex test.html is not ordinarily done in .htaccess. In order for it to work in .htaccess, you will need AllowOverride All (or something similar) within your sites .conf file. Ordinarily, DirectoryIndex test.html is placed in the sites .conf file. This is the best place for this directive. Where you find your .conf files all depends upon your ...


1

The only way to be sure why you are receiving a 403 error is to check the logs. They will tell you the reason why it is forbidden. The DirectoryIndex itself doesn't create any new rule that would provide a 403 error. However, if the error began after you made that change, you likely have Options -Indexes, or a similar line, which gives a 403 message rather ...


0

What you are searching for is known as a CNAME record. With Windows Azure you will be given a public URL for the service usually under a domain associated with Azure. From there you change the current A record to a CNAME record with the same sub domain name and simply add the public domain for the Azure service. What will happen then is when a user tries to ...


2

A site doesn't have to have a .htaccess file. If you don't have a .htaccess file, your site will run on the settings in the apache and PHP server configuration files. Having your file named .htacces.txt (or .htaccess.bak for that matter) will not have any effect on your server, it won't refer to the file for any settings. If you then rename your file to ...


2

Firstly if the file is named htaccess.txt then that means the htaccess file is not enabled as only the file named .htaccess will work. Secondly if you are getting a 500 error when you enable the .htaccess file you either have an error in your htaccess syntax or overrides are not supported. You would need to check the error logs to see which one it is. Some ...


1

I suggest you add [R=301,L] after your RewriteRule in your .htaccess to redirect the visitor, like so: RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] Currently your telling the browser "There is a https version I want you to visit". The R=301 adds "I want you to go there via a 301 reload". It's the reload part you don't have in place ...


1

How does google determine these pages are compromised if there are no malicious code can be found from both my browser or google's "fetch as google"? Google may be using a separate IP address that is not the same as that used when the "fetch as google" operation is performed. For example, someone actually working at google might be randomly manually ...


0

If you use cPanel, you can change the setting through there: Select Advanced > Indexes (might be called Index Manager depending on your version of cPanel) Click public_html (or whatever your web root is) Select No Indexing Click Save



Top 50 recent answers are included