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
48 views

rewrite url (redirection)

How to rewrite url: www.domain.com domain.com to www.domain.com/sell.html Were sell.html is already rewritten I need some kind of redirection.
2
votes
2answers
294 views

HTACCESS Wildcard Subdomain forward to Domain

I know this may seem like a duplicate, but I am unable to find a solution. Is it possible to setup wildcard subdomains with htaccess? I have an example of http://test.domain.ca I need to forward ...
-1
votes
2answers
2k views

Having trouble redirecting old product sites and categories to new pages

I recently upgraded a shopsystem to prestashop and imported the previous products (~1200), and I managed to keep the old category_id and product_id. I'm trying to set up those 2 rules to redirect all ...
7
votes
1answer
267 views

Apache rewrite rules for development workstation and server

I've got developers editing pages for several sites on a WAMP stack and then uploading to the public servers running LAMP stacks. We're pretty happy with it, but we have this minor annoyance: we can't ...
1
vote
1answer
1k views

mod_rewrite with Apache -> mod_jk -> tomcat

Related to some of my earlier questions. I now have a setup I quite like; Apache httpd listening on port 80 accepting http and https connections. Several Tomcat instances running on several AJP ...
1
vote
2answers
815 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 .* ...
2
votes
1answer
926 views

Enable mod_rewrite on OpenSuSE 11.04

I have a problem on OpenSuSE 11.04. I configured apache and enabled mod_rewrite but it doesn't working. on every php file I get 403 forbidden error.
4
votes
5answers
799 views

Site compromised .htaccess files everywhere

Some of the sites we're hosting are compromised by... I don't know what. Every directory on the webserver contains a .htaccess file which redirects a user coming from a search engine to a page which ...
0
votes
2answers
60 views

mod_rewrite issue, won't work when links contain “-”

I've been looking into mod_rewrite for my simple PHP CMS for a couple of days now and I found a rule that was supposed to work for me: RewriteRule ^(\w+)/?$ view_post.php?url=$1 This is supposed to ...
1
vote
1answer
69 views

Empty Cookie based on IP address

Is there a way to empty a previous cookie based on source ip? I need this to be done because of loadbalancing issues. regards Geert
2
votes
3answers
1k views

mod_rewrite works within directory not on root

I am having a problem with my RewriteRule for the querystring portion. What I am able to debug is that the rule is being triggered at least because the page "tags.php" is being rendered but without ...
2
votes
2answers
355 views

Help with URL Rewrite

I have a page that selects some info from a database and displays it with a link to a second page that uses the result to query the database, something like this: $sel=mysql_query("select id, title ...
2
votes
1answer
3k views

how to rewrite %20 in .htaccess

I need to perform an equivalent rewrite to: RewriteRule ^/this%20file.pdf http://www.example.com/ How do I handle the %20? I have tried RewriteRule ^/this\%20file.pdf http://www.example.com/ ...
2
votes
1answer
5k views

Enable 'mod_rewrite' Using .htaccess File On cPanel Shared Hosting Server

I'm using cPanel to host my website. I need to enable 'mod_rewrite' on this Shared Hosting cPanel account to run my script. I've tried to Google the solutions high and low but did not find any luck ...
1
vote
2answers
237 views

How do I redirect www and non but not IP

I am trying to redirect www.domain.com or domain.com to www.domain.com/temp.html I am using the following code: RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^/?$ ...
1
vote
1answer
194 views

Removing 301 redirect from site root

I'm having a look at a friends website (a fairly old PHP based one) which they've been advised needs re-structuring. The key points being: URLs should be lower case and more "friendly". The root ...
0
votes
1answer
206 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 ...
3
votes
1answer
187 views

Mod rewrite - redirecting url with certain parameter to new url

I need some help redirecting a url with particular parameter value to a new url. For example how can i redirect these two urls with id 123 and 345 to a new url? Redirect ...
5
votes
3answers
15k 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 ...
3
votes
1answer
198 views

How can I redirect all files in a directory that doesn't conform to a certain filename structure?

I have a website where a previous developer had updated several webpages. The issue is that the developer had made each new webpage with new filenames, and deleted the old filenames. I've worked with ...
3
votes
1answer
606 views

Wild card redirect in htaccess giving error this webpage has a redirect loop

In my website I changed the directory name "vehicles-cars" to "vehicles-cars-for-sale". When I tried to redirect using a wild card redirect from my old directory name to new directory name in my web ...
3
votes
1answer
519 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 ...
5
votes
2answers
745 views

.htaccess two different rules but only one per time

I'm rather new to the whole .htaccess thing and I'm using the following right now to use 'pretty url's': <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d ...
3
votes
1answer
626 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" ...
1
vote
3answers
581 views

Transparent PHP script execution using mod_rewrite

I am looking for a solution for this a problem: I need that every HTTP request (method is irrelevant) in Apache http server would be served only after execution of specific PHP script. This is needed ...
1
vote
1answer
89 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 ...
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 ...
0
votes
1answer
74 views

rewrite url for articles with htaccess

I've had a look through several other questions to see if i could get this working but have had no success at all at the moment so i'm hoping someone can help. This is the url i currently have, ...
0
votes
1answer
251 views

How to silently auto-load from a subdirectory, but allow internal paths to think the file is located at site root?

I have files in my site root, and also files in its "Iternet_IE" directory. I need to: 1.) be able to call/include other files (e.g. headers or footers) from within files at either of those ...
3
votes
2answers
428 views

How do I redirect an English language URL to an Arabic language URL?

I have a link that's currently formatted like this: http://site.com/news/view/1.html I want to it redirect it to: http://site.com/خبر/عنوان-الخبر where خبر is equal to news and عنوان-الخبر is ...
2
votes
3answers
267 views

How to use .htaccess to show smarter URLs

I'd like to ask how can I call the page www.domain.com/index.php?page=somepage and make the browser show the user in the URL bar the address www.domain.com/somepage/? How do I do that trick?
2
votes
1answer
3k views

mod_rewrite to edit cookies conditionally

Is it possible to use mod_rewrite to modify values in cookies based upon a condition? I am completely new to HTTP, but I have tried a thing or two. The only regex I know is Perl-style, I hope it is ...
0
votes
1answer
359 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
1answer
493 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 ...
1
vote
1answer
74 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 ...
2
votes
1answer
1k 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 ^/?(.*) ...
2
votes
2answers
4k views

htaccess execution order and priority

Can anyone explain to me in what order apache executes .htaccess files residing in different levels of the same path and how the rewrite rules therein are prioritized? For example, why doesn't the ...
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 ...
2
votes
1answer
423 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 ...
0
votes
1answer
152 views

htaccess Rewrite Syntax?

I have a bunch of files with a "NEW-" prefix (e.g. "NEW-index.php"). I need to do a 301 redirect to the corresponding file without the prefix. I've tried a few things but I'm not getting the regex ...
5
votes
2answers
915 views

Redirect/rewrite dynamic URL to sub-domain and create DNS for subdomain

I have created an application in PHP, I would like to re-direct the following URL to corresponding sub-domain. Dynamic URL pattern: http://mydomain.com/mypage.php?user_name=testuser I wish to ...
1
vote
2answers
781 views

How to redirect a website from a folder to the root folder?

I was running a website on a folder (www.example.com/folder). The new version of the website is live and runs on the root folder. How should I redirect users who visit the website using the old URLs ...
0
votes
1answer
943 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 ...
2
votes
1answer
52 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
519 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
2answers
223 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" ...
1
vote
2answers
325 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 ...
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 ...
2
votes
2answers
906 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 ...
1
vote
1answer
390 views

403 error with a 301 redirect in .htaccess

I wrote a rewrite rule for one of my pages. This rule is supposed to be for a specific single URL only hence the "static-ness". RewriteRule ^picks/categorizedPicks/126$ ...