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

0
votes
1answer
22 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
101 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
274 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
156 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
96 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
260 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
42 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
3k 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
125 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/([^/]+)/([^/]+)/?$ ...
4
votes
1answer
283 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
150 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
843 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 ...
3
votes
4answers
151 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
226 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
367 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
45 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
115 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
187 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
201 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
127 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
569 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
390 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
217 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
155 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
63 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 ...
1
vote
2answers
177 views

Rewrite using .htaccess results in too many redirects

I'm currently creating a webpage which requires rewrites to look nice. The URL is: u.{my_site}/get.php?fid={ID}. The URL entered should be: u.{my_site}/{ID}. Because I'm bad (and new) at rewrite ...
0
votes
1answer
622 views

mod_rewrite problems - redirect subdomain to different domain

I must have a brain freeze as I can not get my rewrite rules working. RewriteEngine On RewriteCond %{HTTP_HOST} ^otherdomain\.example\.com [NC] RewriteRule ^(.*) http://www.otherdomain.com/ ...
2
votes
3answers
148 views

Does purposely linking to an invalid URL and then using 301 affect SEO?

On a section of my site, I am currently using .htaccess rewrites to put the ID as part of the URL instead of in the query, like so: RewriteRule ^([a-z_]+)?/?tours/([0-9]+)/(.*) ...
1
vote
1answer
366 views

Infinite redirect loop in cPanel-purchased script

I am installing a script (that I bought on cPanel) in the root directory of my web site. When I try to install it, it gives me an error. I found that it starts an infinite URL redirect loop containing ...
2
votes
2answers
880 views

Need some help on tomcat URL mod_rewrite or mod_jk

I am trying to remove the context name from the URL of my server. Current URL - http://www.domainname.com/MyApp/ What I need to make is to make it available at - www.domainname.com/ So it is only ...
1
vote
1answer
179 views

Getting the masked URL values in Mediawiki

I have successfully masked the URL in Mediawiki. By using the following scripts in .htaccess and localsettings.php files in Mediawiki, i.e.: .htaccess: Options +FollowSymLinks RewriteEngine on ...
4
votes
2answers
372 views

Case-specific mod rewrite on WordPress subdomain multisite

I have split a WordPress blog into multiple category-specific blogs using subdomains, as the topics in the original blog were too broad to be lumped together effectively. Posts were exported from the ...
4
votes
2answers
2k 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?
0
votes
2answers
85 views

The number of soft 404 errors is increasing because of redirects to the home page

I have an increase in soft 404 errors. Using Apache in my .htaccess file I have: Redirect 301 /test.html‎ /page/pop/test Redirect 301 /about.html‎ /about I have also tried: Redirect 301 ...
1
vote
2answers
719 views

URL rewrite subfolder to root and forbid accessing subfolder

I have Drupal installed in a subfolder drupal but I want to access pages as it is in root folder: http://www.example.com instead of http://www.example.com/drupal I'm able to have this working, but ...
3
votes
1answer
372 views

RewriteRule for URLs with spaces

My site's pages are in multiple languages whereby each language version shares its media (images) with the other language versions. I place all versions and the media in a single directory with the ...
2
votes
1answer
114 views

Rewrite catalog/index.php to www.domain.co.uk [closed]

We have an online shop with a welcome page. Our SEO company has asked us to get rid of the welcome page with a rewrite. I am struggling to get this to work. Can you help please? I want to rewrite ...
0
votes
1answer
268 views

Using Apache's rewrite module to set up local host names for development

I have several websites on my development machine under Apache's htdocs folder. Apache Directory root is htdocs, but I want to be able to access each different site there by individual domain names. ...
1
vote
2answers
122 views

One .htaccess file with rewrite rules for all domains

Our server is configured with multiple domains which reside in subfolders of the public_html folder. So domain1.com is located in /home/user/public_html/domain1.com and domain2.com is located in ...
1
vote
1answer
178 views

What's wrong with my mod rewrite for GEOIP based on location?

I'm a bit of a newb in modrewrite but used it successfully on my server before. I successful installed the module on my apache server and tested out with PHP test page(it correctly returned my area ...
2
votes
1answer
95 views

GeoIP and Mod_rewrite: Should I use latitude or city/town?

My boss wants to change our site to one domain with different sub domains being redirected by location to appropriate business site location. Issue is, these locations are only 100+ miles away from ...
1
vote
1answer
81 views

.htaccess problems with redirection

I apologize ahead of time that this might be a common question, however I've spent 3-4 hours already on solutions which don't quite fix the problem. I have a site and it is moving to a different ...
2
votes
2answers
1k views

Mod-rewrite rule broken after host upgrade to Apache 2.4

I use the following code on my site to remove php extension from links: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
1
vote
2answers
78 views

“pretty urls” with only JavaScript content changing

I have a small webapp that uses a single HTML file, but accepts any URL in the directory. I'm using mod_rewrite to make all of these send index.html. The index page may be accessed at, for example, ...
3
votes
1answer
12k views

How to redirect any URL to lowercase URL?

I have this .htaccess files: ErrorDocument 404 /index.html <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule (.*) ...
1
vote
2answers
267 views

WordPress .htaccess preventing subfolder access

This is sort of a goofy setup, but it's not in my power to reconfigure it at this time. I'm running in a shared hosting environment. The domain is example.com. This is an add-on domain on the host ...
1
vote
1answer
178 views

Mod rewrite is not working or doing anything

So I've used an online .htaccess editor and it's not working for some reason on my test server, here's the content of my .htaccess file. RewriteEngine On RewriteRule ^Page/([^/]*)/$ /?Page=$1 [L] I ...
2
votes
1answer
158 views

how to fix .htaccess - redirect http://408.111.1111.domain.us/ to http://domain.us/index.php?w=408.111.1111

We want to use mod_rewrite and .htaccess to do a redirect. How do we redirect http://408.111.1111.domain.us/ and www.408.111.1111.domain.us/ to http://domain.us/index.php?w=408.111.1111 ? If the ...
0
votes
0answers
97 views

Clean URL using index files or mod_rewrite

Is it better to make clean URL's using index files in directories or simply using mod_rewrite rules to remove the file extensions?
5
votes
2answers
1k 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 ...