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

1
vote
2answers
98 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 ...
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
173 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 ...
1
vote
0answers
177 views

Is my .htaccess rule creating an infinite loop?

Whenever I type a made up address that includes a directory index it removes it. The problem is when the the address includes a forbidden subdirectory. It reduces itself until it hits forbidden. How ...
1
vote
1answer
217 views

Google Analytics shows visits to pages redirected in .htaccess

Yesterday, I switched on a section of pages in our site that replaces a really old collection of pages. In our .htaccess file, I have rules that redirect a request for any page in the old section to ...
1
vote
0answers
58 views

optimize htaccess

I have two condition which are conflict RewriteRule ^patients/findadoctor/(.*)\.html$ subcategorydoctor.php?id=$1 [L,NC] and RewriteRule ^patients/findadoctor/(.*)\.html$ ...
1
vote
0answers
158 views

Mapping different users to folders with mod_rewrite

I'm setting up a DAV server with Apache 2.2 and would like, if at all possible, to be able to redirect a user to their own folder without having per-user URLs, if at all possible. So I point a user ...
1
vote
1answer
34 views

Trouble reading htaccess canonicalization

I just took over development of a site and am having trouble figuring out the canonicalization rewrite rules (not my forte). I've pasted the code below. The first bit seems straight-forward enough, ...
1
vote
2answers
1k views

Have UserDir enabled but also want to rewrite url if called differently

I am setting up a new server for our users to use have have personal webspace on. I have in my httpd.conf of apache the directives for UserDir as follows UserDir disabled root UserDir public_html ...
1
vote
0answers
95 views

Apache Rewrite to folder no longer working after server upgrade [closed]

The following were both working perfectly for the last 2 years but after a server upgrade the first, with an extra folder is no longer working: RewriteCond %{HTTP_HOST} ^www\.mayoaccommodation\.com$ ...
1
vote
0answers
127 views

Apache, Rewrite Rule and Directories

I'm using the current virtual host: <VirtualHost *:80> ServerAdmin webmaster@mysite ServerName example.co.uk ServerAlias www.example.co.uk DocumentRoot ...
1
vote
1answer
381 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
1answer
94 views

Mod Rewrite - url rewriting

I am very new to mod rewrite. I need to redirect any user with "citzenhawk" parameter in their url to my url for example ...
1
vote
2answers
1k views

Re-indexing website with clean URL's

So I have a website with URL's like this: http://www.domain.com/profile.php?id=151 I've now cleaned them up with mod_rewrite into this: http://www.domain.com/profile/firstname-lastname/151 I've ...
1
vote
3answers
257 views

Including title page name in PHP URLs

How do I show titles of the page in URLs? Currently: http://websitename.com/index.php?c_id=18&start=0&m_id=1 Change To: ...
1
vote
2answers
117 views

Beginner's Apache mod_rewrite - use custom file for website root

Plain and simple - I want user to get main.php file instead of index.php, when he enters website. Such a straightforward task has caused me a lot of pain, and couple of hours googling. Following does ...
1
vote
2answers
196 views

Google Analytics when 404 handler is used as 'mod_rewrite'?

I'm consulting on a web site which in order to provide clean URL's uses the 404 handler to catch what would otherwise be a 404 and serve the correct content. In case that's not clear the 404 handler ...
1
vote
1answer
358 views

Apache rewrite returns error 500

I'm trying to figure out what I'm doing wrong with this .htaccess rewrite: Options -Indexes RewriteEngine on RewriteBase /test/site/ RewriteOptions MaxRedirects=10 RewriteCond ...
1
vote
1answer
240 views

Kohana with cherokee

How to setup kohana's index.php with cherokee webserver? Should i add a rule to redirect all to index.php? These settings don't work Rule RegExp ^.*index.php.*$ Redirect ^(.*)$ => index.php$1
1
vote
1answer
75 views

wrestling with some rewrites for Apache

I have upgraded my gallery2 to gallery3, and notice that some links no longer resolve correctly. Since the proper way is to redirect these with a 301, that is the way I'm going. The following series ...
0
votes
1answer
194 views

just another mod_rewrite question

from the url xxx.yyy.site.com just need to redirect to xxx.site.com Thanks for the help, sorry I have no regex/rewrite foo.
0
votes
1answer
731 views

Rewrite URL to a PHP script with parameters

I'm trying to create a service that you give it a URL like http://myhost.com/34.png and it will return the result of the script http://myhost.com/create_image.php?count=34. I know this is possible ...
0
votes
1answer
559 views

Using mod_rewrite to rewrite URLs with question marks in them

This is probably a mind-numbingly simple question, but for some reason mod_rewrite always manages to completely befuddle me every time I interact with it. A long time ago when I set up my blog and ...
0
votes
1answer
209 views

htaccess 301 Redirect with URI

How can I write a .htaccess mod_rewrite rule to redirect all traffic to a specific subfolder to a different subdomain, but include all the trailing URI and url structure and in a SEO friendly way. ...
0
votes
1answer
37 views

Google can no longer fetch pages after successful URL rewrites using an .htaccess file

I tried to rewrite my URLs so they no longer have the .html extension. But when I did this (successfully) Google can no longer crawl my pages when I use "Fetch as Google". Instead, it returns 404 ...
0
votes
1answer
14 views

RewriteRule not working at server level?

I wanted to forbid some robots from doing certain things to my websites and decided to add a RewriteRule for that purpose. The rule works when put in one of my <VirtualHost *:80> tag and looks ...
0
votes
2answers
255 views

Pretending a file is in subdirectory with .htaccess

I have a web application, and it has a RESTful PHP backend that uses Zend framework (which does its own URL rewriting magic). The problem is, my backend's entry-page is api.php and the endpoints look ...
0
votes
2answers
661 views

SEO on multilanguage website URL

I'm setting up a multilanguage website and I would like to have your help to take the best decision as regard SEO. After reading this. I would like to change my URLs from this form ...
0
votes
1answer
985 views

Link to pages on site without .html extension appearing in browser?

I've modified my .htaccess file to allow access to html files without having to include the extension on the end, for example: www.mysite.com/document directs to www.mysite.com/document.html ...
0
votes
2answers
1k views

.htaccess rule not working without HTTP redirect [R]

I am using the following .htaccess with Wordpress to remove index.php from the visible URL. This works but forces an http redirect so the URL changes in the browser window. If I remove the [R] it no ...
0
votes
1answer
224 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 ...
0
votes
1answer
140 views

Switch to https

I'm looking to use an .htaccess file to use mod_rewrite to switch the protocol from http:// to https:// when someone hits my website. For instance, once someone goes to: http://www.mywebsite.com/ ...
0
votes
1answer
371 views

How to use apache mod-rewrite to remove trailing semi-colon on cookie?

We have the following cookie set by a product: Set-Cookie: SSOCookie=T7ngsCmzC2FEq5p2a7o%3D; path=/; domain=.demo.com; We would like to use Apache to remove the trailing ; which doesn't match the ...
0
votes
2answers
85 views

RewriteRules targeting a directory result in a gratuitous redirect

I have a standard CMS-like RewriteRule set up in my .htaccess: RewriteRule ^(.+)$ index.php?slug=$1 Let's say I have a directory called "foo" in the root directory. For some reason, if you hit the ...
0
votes
1answer
386 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 (.*) ...
0
votes
3answers
31 views

Problem getting rewrite from subdomain to directory to work

I want to redirect demo.example.com to example.com/my-demo. This is my rewrite rule, but I'm not getting it to work on my production server: RewriteCond %{HTTP_HOST} ^demo\.example\.com ...
0
votes
2answers
47 views

Mod_Rewrite Error code: ERR_TOO_MANY_REDIRECTS

I know alot people have post about this error , however i still unable to solve it.So that is the reason why i start a new post with it. As stated in the title , i encounter a redirect loop when ...
0
votes
1answer
179 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 ...
0
votes
2answers
83 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 ...
0
votes
1answer
257 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. ...
0
votes
2answers
149 views

Redirecting non existing post to homepage; is that good for SEO? [duplicate]

I am checking my website out on Google Webmasters and I am seeing an astonishing 5000 links that could not be found by Google's Crawlers. That's normal, because my website is built in a manner that ...
0
votes
2answers
178 views

To Fix HTTP 400-499 error codes with 301 redirects in .htaccess file

This issue is on Wordpress site. I am aware we can change the URL naming convention in WP but i have changed my url format from date format to simple postname followed by slug as shown below. old ...
0
votes
1answer
113 views

Capitals in URL subdirectory not changed by htaccess

Within my WordPress website I am redirecting sub directories to internal and external links. Now, when you place a CAPITAL letter in the sub dir it does not work anymore and the website does not show ...
0
votes
1answer
217 views

mod_rewrite and SEO friendliness

My website has an atypical structure and I'm not sure if this could create problems in the long run, specially for SEO positioning purposes. I have a unique, large PHP script, and I use the Apache ...
0
votes
2answers
524 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 ...
0
votes
2answers
555 views

When using Mod_rewrite does google bot see the original url or the rewritten url?

If i use the bellow code in my .htacess file would google bot (or any other search spiders) see the example.tumblr.com url or would they see the same url as the user ie. example.co.uk/blog ? ...
0
votes
1answer
604 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/ ...
0
votes
1answer
228 views

htaccess - “detect” url and redirect

Idea is: if URL = "http:/localhost/site/" else if URL = "http:/localhost/site" redirect to "http:/localhost/site/index.html" Can this be done with .htaccess / Apache mod_rewrite and how?
0
votes
1answer
393 views

short and friendly URL for affiliate links

This is my first question here on Pro Webmaster... I'm really glad to be here! I believe this question will have a simple answer but I'm starting with htaccess and I want to learn something about ...
0
votes
2answers
2k views

.htaccess rewrite www to non-www and remove .html

I need rewrite rules to redirect the following: http://www. to http:// /file.html to /file I've tried using a combination of these but each time it results in a redirect loop on one of the ...