mod-rewrite

How to alter the url of a directory

I need to change the url of a directory so that: www.example.com/foo/ becomes www.example.com I can't move the files. Putting a htaccess file using mod_rewrite to simply rewrite www.example.com to www.example.com/foo wasn't a problem RewriteEngine On RewriteRule !^foo/ foo%{REQUEST_URI} [L] However I must ensure that if the use...

Regex question using IIS7's URL Rewrite module

I'm using URL Rewrite module in IIS7 and using the User Friendly URL Rule template. I'm trying to get URLs like: Something/param1/something/param2/something/param3/something/something2/ etc.etc. to rewrite to SomethingEnd.aspx?param1=something&param2=something&param3=something/something2& etc.etc. Using the templates, it automatic...

GET Variables Show Up in URL on .htaccess Rewrite of URLs That Don't Terminate with /

I'm having an issue with my rewrites exposing GET variables if the originating request isn't terminated with a forward slash (/). Here's my rule: # All requests are routed to PHP RewriteRule ^(.*)$ framework/index.php?framework=$1&%{QUERY_STRING} [L] If I visit: http://www.domain.com/folder/ everything works great. If I visit: htt...

apache/htaccess url rewriting help .

Okay what i want to do is ... http://domain.com/hdu79ejo above should be redirected to http://domain.com/client/?share=hdu79ejo where hdu79ejo can be any value. But ... http://domain.com/client and http://domain.com should not be redirected at all. Here is my code RewriteEngine on RewriteCond $1 !^(client) RewriteRule ...

htaccess rewritecond

Hi, We have a domain name with various TLDs. Let's use example.com as our main URL, and we redirect example.biz, example.net, example.org to example.com. We had the following in .htaccess file and it worked very well: RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] You notice...

mod_rewrite 301 Redirect: from old to new dynamic url

I am trying to get a mod_rewrite working correctly. Here is the code: RewriteCond %{QUERY_STRING} ^main_page=product_info&products_id=301$ RewriteRule ^index\.php$ /blog/shop/index.php?route=product/product&product_id=301? [R=301,L] It works, but in the end of the new URL %3f is added. Can somebody help me to get it work?...

Need to make one RewriteRule play nicely with another, embarrassingly weak understanding of the principles of mod_rewrite standing in the way

Hey folks, I have the following system: Windows Server '03 IIS 6 (shoot me) PHP 5.2.14 Wordpress 3.0.1 WPML 1.8.1.2 I've added Wordpress to an existing high-traffic site, in a directory we'll call http://thehost/wordpress/ For mod_rewrite-like features, I'm using Helicon's ISAPI_Rewrite 3.1.0.76. I'm using it to enable "pretty" perm...

.htaccess - help with a rewrite rule for ssl

So I've got a website and an SSL certificate. Everything is set up and working, however, both http://example.com/checkout and https://example.com/checkout work. I'm hoping there's a way to write a rule where anything going to /checkout is rerouted to https. Ideas? ...

Android InputStream following a rewriterule

I'm trying to parse an xml file from a website. Let's say the website is "http://example.com" This website has a htaccess rewrite rule setup to redirect anything with a "www" prefix to the host back to example.com. so "http://www.example.com" would redirect to "http://example.com" In my code I have a URL that i get the InputStream of....

Shimmie2 on nginx (Rewrite)

Hello guys, I'm porting the rewrite rules of shimmie2 to nginx and ran across a problem: From the first impression it worked quite well, but when you try to view the image (I mean via right-click menu in your browser) you end up with stuff like this, instead the original image: ÿØÿà�JFIF��H�H��ÿÛ�C� ÿÛ�CÿÀ���À�ÿÄ�����������...

Save HTTP_REFERER with mod_rewrite?

Hi everybody, actually I'm trying to pass referers inside the .htaccess. What I'm trying to do is that the referer value shall be send to a PHP script where this value will be saved to a databse. In some cases (depending on the referer) the image shall be blocked (hot linking) and in some other cases the image shall be shown normally. B...

apache rewrite conflict

I know something's conflicting but being a mod rewrite Muggle it's time to ask for help. I am re-writing http://test.com/[name]/ to http://test.com/script.php?id=[name] with success, using: (rule#1) RewriteRule ^(.*)\/$ script.php?id=$1&%{QUERY_STRING} [L] Next, I rewrite http://test.com/[name]/foobar/[key] to http://test.com/script....

mod_rewrite and php variables

I am trying to get mod_rewrite to work with my site but for some reason it's not working. I've already entered code into my .htaccess file to redirect non-www to www so I know mod_rewrite is working in general. The url's I'm trying to change are example.com/index.php?p=home so the new URL would be example.com/page/home However, when I ...

How to store pictures in files on server to preserve privacy for some of those in WWW

I am planing to bulid www portal in PHP, where many pictures will be stored. I decide to store pictures in directories at the server(not DB) for performence reason. Some pictures will be accessible for all users from internet, and some (if user set them private) not according to session id. What is the best solution of this problem? Perf...

Expression engine multi-lingaul site on one install

Hi There, I am currently working with expression engine, and we are wanting to create a multilingual site, using just one instance of expressionengine, without having to pay for the multi-site license. For this reason I have a couple of questions? I know it is possible to set up the system so we can a domain structure of something ...

re written url causing duplicate pages

I have tried to rewrite my url so that it removes php extention and adds trailing slash. I can access the page this way now.. lovelakedistrict.com/lake-district-cottages/ but i can also access it via this way: lovelakedistrict.com/lake-district-cottages.php how can I remove the php extention for good. this my htaccess Options +Follo...

change domain.com/folder/stuff to domain.com/stuff using mod_rewrite

I would like to 301 redirect domain.com/folder/blah_blah to domain.com/blah_blah How can I do this using mod_rewrite? ...

ajax file not loading because of trailing slash

I have an ajax file that is called when someone begins to type in search bar. I have recently been cleaning up my urls and removing file extentions adding trailing slashes, since then my ajax file doesnt appear to load anymore. can anyone help? here my htaccess so far Options +FollowSymlinks Options +Indexes RewriteEngine on RewriteCo...

Very basic rewrite-rule question

I have this url: http://www.mydomain.com/index.html And want a rule to rewrite the above into this: http://www.mydomain.com In other words, remove the index.html part of the code... Something like this maybe: RewriteRule ^$ index.html [NC] Thanks UPDATE: When you type www.domain.com into the browser, offcourse index.html ...

Do You Have to Escape a Forward Slash When Using Mod_Rewrite

I am very sorry if this question has been asked before, I have searched but I am still quite unsure. With regards to the forward slash "/" when giving a RegEx to RewriteRule or RewriteCond, or anything else related to .htaccess in particular, is there a need to escape the forward slash? Here is an example of what I am trying to achieve...