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
2answers
591 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 ...
2
votes
1answer
53 views

Finding out what features of regular expressions are supported by mod_rewrite in Apache 1.3?

Is there a particular regular expression engine that is used by mod_rewrite on Apache 1.3? I want to know so I can get a list of supported and non-supported features.
0
votes
2answers
583 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 ? ...
2
votes
1answer
290 views

.htaccess rewrite , parked domain on another site to read the proper domain name

I have a parked domain example.co.uk on another domain name web-space in a folder and need to rewrite the domain name in the browser URL as it currently shows the other domain name while browsing and ...
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
2answers
343 views

WordPress mod_rewrite redirect specific folders

As a new user, I'm not allowed to post more than two hyperlinks here. So I have added a space after every http (ignore them and read as full URLs). System: Debian Etch, Apache 2.2 I have a WordPress ...
2
votes
2answers
264 views

How can I test for a URLs existeance before redirecting to it?

I am using Apache's mod_rewrite to redirect mobile users to my mobile site based on their http_user_agent. However not all pages have a mobile equivalent. Also mobile pages end in .html and "full" ...
2
votes
2answers
1k views

apache rewriting url doesn't work(using godaddy hosting)

I'm using a framework to create my website(codeigniter) by default the urls are like this:mysite.com/index.php?/etc/etc/etc. And I'm trying to remove the index.php?, I tried to remove it by doing ...
2
votes
1answer
265 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
3answers
273 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: ...
0
votes
1answer
642 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
1answer
494 views

Htaccess - Rewrite png to php file

I currently use trans.png.php?id=1&campaign=test to track my newsletter campaigns. I want to use trans.png instead as it's the src of an img tag. How can i do this in htaccess? Also is there any ...
4
votes
2answers
3k views

How to write a generic .htaccess file rule, regarding RewriteBase

The following rule in my .htaccess works just fine for routing calls to index.php: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] However, this does not ...
2
votes
1answer
2k views

.htaccess - lose the file .html extension

I'm having a bad .htaccess day! I want a user to be able to type the URL mysite.com/about instead of mysite.com/about.html On .htaccess file I have: RewriteEngine On RewriteCond ...
3
votes
1answer
610 views

RewriteRule working local but not on remote server

I have a .htaccess file with one simple RewriteRule: RewriteEngine on RewriteRule ^([A-Za-z0-9-]+)$ ?site=$1 I want to have an url like http://www.example.com/imprint and forward it to ...
1
vote
2answers
1k views

Having mod_rewrite not rewrite requests for a particular directory

I have many forward rules written in my .htaccess file. However, for the requests to a certain directory and its subdirectory, say wordpress, I don't want to use the forward rules. RewriteEngine On ...
2
votes
1answer
101 views

301 redirects mirrored domain

I'm redesigning a site for a friend on my localhost. His old site is an .asp based site and we're replacing it with a WordPress site on LAMP hosting. The old site sits on domain A and also has another ...
3
votes
1answer
702 views

Rewrite img and link paths with htaccess and serve the file from rewritten path?

I have a static mockup page, which I want to "customize" by switching a variable used in image-src and link-href attributes. Paths will look like this: <img src="/some/where/VARIABLE/img/1.jpg" ...
3
votes
2answers
352 views

Apache HTTP redirect from a URL list

One of my web applications will be completely replaced by a new system. All URLs will change and thus external links would break. I want to setup Apache httpd to answer with proper 301-redirects to ...
4
votes
1answer
2k views

When is the leading slash (/) needed in mod_rewrite patterns?

Here is an example from the Apache documentation for enforcing canonical hostnames: RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/?(.*) ...
3
votes
2answers
330 views

Create friendly looking URL's with mod rewrite

I want to make the pages on my site more search engine friendly by turning the query strings into meaningful looking page names. For example I have a page that is this: /search.php?c=18 I want it ...
1
vote
2answers
289 views

.htaccess remove index.php/url/ from URL

.htaccess is not working. /index.php/user -- is working http://www.example.com/user is not working Current .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
0
votes
1answer
190 views

Redirect domain address to host address with cloaking [duplicate]

Possible Duplicate: What is the best way to redirect my naked domain? I have purchased a domain name with hosting. I would like visitor to my website http://www.smarttelecom.be to see only ...
2
votes
1answer
144 views

Is it possible to check the case on Apache redirects or aliases?

I have a big website (15,000 pages) with a log list of redirects (about 800) that have been used in marketing pieces for years. My Apache server has been running mod_rewrite for the past 10 years or ...
1
vote
1answer
2k views

Apache rewrite to 404 except for matched query

I'm trying to handle logically simple operation, but apache rewrite does not handle my website's query strings requests. I heard it's does not do it eventually. Still cannot understand it's regex ...
1
vote
1answer
260 views

Apache: use `foo.html` in preference to `foo/` when both exist

How to get Apache 2.2 to use foo.html in preference to foo/ when both exist? I'm moving a site from dynamic php to static html, while retaining the domain name. I've created a temporary mirror using ...
0
votes
1answer
235 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?
5
votes
2answers
431 views

What should I do to notify Google of a switch from “.php” to extension-free URL's?

I've implemented a simple mod-rewrite rule that internally rewrites urls without a file extension (that are not directories) to .php files and removed the .php extension from all our internal links. ...
2
votes
3answers
4k views

.htaccess mod_rewrite 500 internal server error

Whenever I place my .htaccess file in my web directory I receive a 500 internal server error and within the error.log file specifying: [Sat Jan 21 13:46:07 2012] [error] [client xx.xx.xxx.xx] Request ...
2
votes
1answer
2k views

How do I make SEO friendly URLs from my PHP pages?

I'm pretty new to this and was wondering how to turn my site URLs into SEO friendly URLs using .htaccess and mod_rewrite? My URLs take the form mydomain.com/index.php?pid=1&pagename=Some Page I ...
4
votes
1answer
286 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
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 ...
1
vote
2answers
3k views

How do I make SEO friendly URLs?

My url is: website.com/profile/?id=24 I want it to be: website.com/profile/kevinlee The ?id=24 will be replaced with the username of the id=24 in the database How do I convert it to that?
1
vote
1answer
1k views

Redirecting not working properly in Firefox 9 (or any older version for that matter)

How do I fix a redirect in Firefox so that it leads my site to another address but with a slash at the end of it? This is my redirect in .htaccess: RewriteCond %{HTTP_HOST} ^test\.mydomain\.com$ ...
1
vote
2answers
118 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 ...
0
votes
1answer
400 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 ...
5
votes
3answers
19k views

How to remove trailing slashes from URL with .htaccess?

The situation Across the entire domain, we'd like the URLs to hide file extensions and remove trailing slashes, independent of the domain name itself (as in, works on any domain). Sample of our ...
2
votes
1answer
85 views

Why is this mod_rewrite redirecting my domain?

I'm trying to redirect all URLs past the "/" of my domain to an old.mysite.com version, but leave the mysite.com itself alone. For example, "mysite.com" -> "mysite.com", but "mysite.com/some-url" -> ...
1
vote
1answer
1k views

Apache rewrite rule for all pages after domain name

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name Sorry for redirecting, but I wasn't aware of ...
5
votes
1answer
11k views

How to pass GET parameters to rewritten URL?

I have an .htaccess rewrite rule like this: RewriteCond %{SCRIPT_FILENME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^search/(.*)$ search.php?q=$1 What this does is, if someone visits ...
1
vote
2answers
724 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 ...
0
votes
1answer
222 views

How to block my images from being displayed by other websites? [duplicate]

Possible Duplicate: How is anti-hotlinking done? I have a lot of images on my site and I don`t want to let other people to use my images on their sites. Is there any way to block the use of ...
3
votes
1answer
180 views

Looking for a step by step guide to URL re-writing with mod_rewrite and other methods

I'm looking for step by step resource about how to rewrite URLs and have a few specific questions. I've read the documentation on mod_rewrite in Apache, but I still find myself a little lost. If ...
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
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 ...
1
vote
3answers
706 views

What's wrong with my htaccess ? (500 Error)

I've written a small htaccess file to redirect Internet Explorer users to a specific page Here are the contents : # MS Internet Explorer - Mozilla v4 RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ...
2
votes
0answers
131 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/([^/]+)/([^/]+)/?$ ...
1
vote
1answer
411 views

mod_rewrite to change parts of a URL causes infinite loop error.

I moved my website to a new CMS and some of my URLs look different now, so I want to delete a part of incoming URLs so that links to my page still work properly. The old URL looks like: ...
1
vote
2answers
902 views

getting mod_rewrite to work on Mac OS X

I'm trying to get mod rewrite to work on my Mac. This is the content of the .htaccess file: <Files *\.ini> order allow,deny deny from all </Files> RewriteEngine on RewriteRule .* ...
3
votes
3answers
222 views

mod rewrite condition !-f being violated

I am using Wolf CMS, which is served by PHP. I want to redirect /index.html to /index.php. I put the following in .htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ...