mod_rewrite is a URL rewriting module for the Apache web server. It is commonly used for so-called "pretty" URLs because of its ability to redirect on the server side (transparent to clients and their browsers), but also provides the power and flexibility to perform various request handling tasks ...

learn more… | top users | synonyms

2
votes
2answers
121 views

Error 404 after rewrite query strings with htaccess

I'm trying to redirect the URLs of a client's website like this: www.localsite.com/immobile.php?id_immobile=24 In something like this: www.localsite.com/immobile/24.php I'm using this rule in ...
0
votes
0answers
9 views

Rehosting content from another server

We have a set of static pages that will augment a customer's existing site. The pages will not reside on the customer's servers for logistical reasons and because we need to maintain control of the ...
1
vote
1answer
16 views

Apache mod_rewrite SSL vs Non-SSL

I have my site setup with two conf files (one for SSL and one for Non-SSL ) The two confs are at this gist -> https://gist.github.com/akinsgre/9645179 The Non-SSL configuration works fine. When ...
1
vote
1answer
25 views

Apache URL redirection not working with mod_rewrite

I want to redirect the URL: http://example.com/site to http://example.com/~username/site I have the following in my httpd.conf file: RewriteEngine on RewriteRule ^/site/(.*) /~username/site/$1 ...
2
votes
1answer
144 views

Using .htaccess, can you hide the true URL?

So I have a web hotel with 1 main website http://www.myrootsite.com/ and a few websites in subdirectories, in a folder called projects. I have domain names pointing to the subdirectories, but ...
2
votes
1answer
340 views

Apache htaccess results in files being downloaded instead of displayed

So I had this "beautiful" website that did exactly what I wanted it to do. Then I shut down my PC, reboot and...the pages just download now instead of being displayed. I re-installed XAMPP and ...
1
vote
1answer
17 views

How to eliminate /wiki/ directory in rewrite rule on a site dedicated for a wiki

I have set up a subdomain of my site (for the purposes of this question I'll call it wiki.example.com), installed a wiki there, and set up URL rewrite according to the article on MediaWiki's website ...
0
votes
0answers
21 views

Apache mod rewrite rules for swapping directories

I am trying to correct for an issue where some dynamic urls were generated where the downstream directory paths were swapped with what is normal and then the links were published. For example: ...
1
vote
2answers
2k views

“File does not exist” in Apache error log when mod_rewrite is using

I am getting below error in server log, when re-writing the URLs. [Fri Jan 25 11:32:57 2013] [error] [client ***IP***] File does not exist: ...
0
votes
0answers
17 views

Apache/ISS equivalent

I've always used Apache for all my web development work and I'm struggling to get my head around IIS. I've got an API that re-routes all requests to one particular file: 'api.php', how would I do the ...
0
votes
1answer
26 views

Masking / mapping URL's with .htaccess

I've recently been trying to come up with a way of masking the visible URL in the browser (so not 301 redirecting) and still show the same content as the original URL. Here is the scenario... ...
1
vote
2answers
38 views

Redirect domain.com:81 to domain.com

I need to redirect www.domain.com:81/site/ to www.domain.com. I have used mod_rewrite a few times, is it possible to solve this in a similar way?
0
votes
1answer
74 views

URL rewrite from www.domain.com/sudirectory to http://domain.com/subdirectory

I need a solution for the following problem: I use a CMS and want the backend only be available at http://domain.com/backend and not at http://www.domain.com/backend. How do I have to change my ...
1
vote
1answer
92 views

How to redirect if directory does not exist or should not be seen?

I am using Apache and want to modify my .conf file for a website such that: If the request comes from my IP 1.2.3.4, just display the URL/page as requested If the request is not from my IP and the ...
1
vote
1answer
356 views

Using mod_speling with multi-level htaccess and rewriterules

We recently switched formats for managing our 301s. For the most part, everything went well, but it seems to have stopped mod_speling from working properly. Here's what we changed: old ...
1
vote
2answers
463 views

Remove .php and id from URL and replace with slash

I have tried lots of URL rewrite rules in .htaccess but I am stuck now. I have to change this URL: products.php?id=31 to products/31 I have used: Options +FollowSymLinks -MultiViews ...
0
votes
0answers
31 views

HTTPS redirect to HTTP not working with 'www' subdomain

I have 2 rules on my site: one to force the www subdomain, and another to force the HTTP protocol: RewriteEngine On RewriteBase / RewriteCond %{HTTPS} =on RewriteRule ^ ...
0
votes
1answer
104 views

URL rewrite to another folder and file for specific requests

I have following directory structure on my local LAMP: www basic app router.php public index.html .htaccess and I can access my index page with localhost/basic/public/ and I am not using ...
2
votes
1answer
93 views

Apache rewrite rule to add a directory in front of a file

I have an HTML page in my root directory, and when someone clicks it I'd like there to be a directory before the file name, that doesn't exist. For example, instead of just being able to access: ...
1
vote
0answers
26 views

Geolocalization and Redirection

I have a multilanguage website. My project was to add the Geolocalization so base on the country that open the site to redirect in the specific url with the right language. The structure of the ...
1
vote
1answer
67 views

Would phpBB break if I move it from one folder to another? Can I use mod_rewrite to redirect requests for that forum from old folder to new one?

Please note that I have installed dynamic web pages (PHP) in the directory *public_html/old/* in order to create the web site www.example.com. Actually I have created a PHPBB forum and thus the URL of ...
2
votes
1answer
64 views

Changing file extensions in URIs - Server Error after Apache upgrade

Please can anyone help to identify flaw or incompatibility in .htaccess code causing server error? In the process of changing over from static to dynamic website, I had to maintain some static files ...
5
votes
2answers
489 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 ...
4
votes
1answer
70 views

Is there any difference, from Google's point of view, on the method used for a 301 redirect?

I have a website with an extremely good Google rank for it's particular niche. I've rebranded and need to redirect to a new URL. In the eyes of Google, what's the difference, if any, between the ...
1
vote
1answer
22 views

Proper syntax for .htaccess Rewrite

I'm very new at this so apologies if this is too easy, but would this be proper syntax for redirecting an entire site to a new domain? This is what was suggested so my other concern is blank lines, ...
0
votes
1answer
17 views

How can I rewrite to my .htaccess in PHP? [duplicate]

How to rewrite my URL from http://www.mysite.com/listingsecond.php?ID=1 to http://www.mysite.com/listingsecond? How can I rewrite to my .htaccess in PHP to do this?
1
vote
2answers
86 views

IP, and page-specific redirect?

I'm trying to send a particular IP, that is trying to get one page on my site, to another page, and do this through my .htaccess file. I've seen many general descriptions of how to do it (in many ...
0
votes
0answers
91 views

SocialEngine 4.5 redirect loop problem

I am installing SocialEngine 4.5. Here is the .htaccess file in the first level of the SocialEngine /public_html/social_engine2/ directory: # $Id: .htaccess 7539 2010-10-04 04:41:38Z john $ ...
1
vote
1answer
85 views

Using RewriteBase in .htaccess to make links pretty

I'm working on a project right now and I'm trying to make the links pretty. We have urls like this: http://subdomain.domain.com/DynamicCountry/DynamicName/file.php What I'm trying to do is set the ...
1
vote
1answer
76 views

What is occurring in this .htaccess file in regards to rewriting to clean URLs?

I have the following code in my .htaccess file, which is working fine and using "pretty" permalinks to reroute everything back to /index.php, and using $_GET values to serve customized content based ...
2
votes
1answer
245 views

mod_rewrite for directories

One of our developers who built the framework that our website uses is no longer with us and I appear to have a stack of issues across the site currently, one being URL rewriting across the site. ...
1
vote
1answer
40 views

Changing www to point to non-www, instead of the opposite, using .htaccess

I'm switching servers and need to change the following RewriteCond and RewriteRule commands in the .htaccess file. Right now I'm pointing domain.com to www.domain.com using: RewriteCond %{HTTP_HOST} ...
1
vote
2answers
1k views

.htaccess language redirects with SEO-friendly URLs

How do I setup my .htaccess file to detect several languages, and redirect them to specific SEO-friendly URLs? Basically every URL needs to go to index.php?lang=(...). So, for English language ...
2
votes
0answers
112 views

Rewrite rule not matching second level directory URL [closed]

I have this .htaccess in a po_systems folder of my website # Set up mod_rewrite RewriteEngine on RewriteRule ^build_system/([^/]+)/([^/]+)/?$ ...
3
votes
1answer
271 views

Dynamically rewrite URLs upon the user's selection - is it possible?

In my PHP based web application, there's a form that generates a URL according to the user's selection. The form has 7 different fields, each one of them affects the final URL, none of them is ...
0
votes
1answer
87 views

How to secretly rewrite Google Analytics campaign codes to main page?

I want to create a simple "secret" mod_rewrite redirect (not shown in user's browser address box) to redirect: http://www.mydomain.com/code -> ...
3
votes
1answer
478 views

Using .htaccess to set a cookie and 301 redirect

I currently have in my .htaccess: RewriteRule ^$ http://chfmaine.com/ [CO=moved:yes:chfmaine.com:1/,R=301,NE,NC,L] I was basing this off of this post. That's a lot more than I need but the setting ...
2
votes
4answers
143 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 ...
0
votes
1answer
222 views

How can I point a subdomain at another server? [duplicate]

Possible Duplicate: How to point a domain to another subdomain? Is it possible to set up a subdomain to render content of another server? Let's say I wanted google.domain.com to render ...
2
votes
1answer
244 views

Rewrite rule not working for redirect in subdomain hosted in a subdirectory of the main site [closed]

I am running a WordPress network. This means there are multiple websites produced by one installation of WordPress. Each website is a subdomain of the parent website. WordPress handles the creation ...
1
vote
0answers
40 views

Two stage Apache rewrite not working

I had a list of "Redirect permanent path/to/url1 http--//domain2.com/path/to/url2" rules working as a test, but when I attempted to couple them with mod_rewrite rules to catch non-matching domain1 url ...
1
vote
1answer
93 views

Rewrite URLs not working - wrong method or conflict?

I've been at this for about an hour now and I'm not having much luck. htaccess files are quite new to me, so I'm obviously doing something very wrong. Current htaccess content, which I need to keep: ...
1
vote
2answers
184 views

How to setup up .htaccess rewrites for http and https on the same site?

I'm having some issues with htaccess rewrites i need to redirect different parts of my site to HTTPS rather than HTTP, for example login and news sections. I'm not sure how to go about doing this in ...
3
votes
1answer
157 views

Redirect www to non-www using Apache htaccess does not work

I have this in my .htaccess (modified from the default Drupal .htaccess): RewriteCond %{HTTP_HOST} ^www\.website.com\.com$ [NC] RewriteRule ^(.*)$ http://website.com/$1 [L,R=301] In theory this ...
2
votes
1answer
90 views

Go up one directory in mod_rewrite

I've got a standard Zend Framework 1 project that looks a bit like this: Project |- public |- .htaccess |- index.php The .htaccess looks like this: RewriteEngine On RewriteBase / RewriteRule ...
0
votes
2answers
459 views

Redirecting IP address to domain address

Google has indexed the IP address of my site rather than the domain, so now I'm trying to set up a 301 redirect that will redirect the IP address and all subsequent pages to the domain. I currently ...
1
vote
1answer
257 views

.htaccess rewrite wildcard folder paths from host

My desired result is change a file to root / from a N number of paths. For example: www.host.com/a/b/c/e/f/g/images/1.jpg, where A~G is not always given. Result: www.host.com/images/1.jpg. This is ...
4
votes
1answer
191 views

Redirect non-www to www while preserving protocol

I am aware of the fact that there are tons of questions in this section and in server fault dealing with re-directions from non-www to www URLs. But I couldn't find one dealing with this issue while ...
1
vote
1answer
113 views

Rewrite rule for friendly URLs to index.php is not working from htaccess

Trying to get SEO Friendly URLs to work for my website using the following htaccess: RewriteBase / RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
2
votes
1answer
58 views

Rewrite one URL to another, and then block the first one using Apache mod_rewrite

Description: I've changed with RewriteRules (no redirect) a typical PHP-like URL: domain.com/script.php?parameter=value to more friendly one: domain.com/script/value But I still can reach the ...