mod-rewrite

Is there a way for making the re-write rule exclude some folders?

I have this in my .htaccess file: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress I want this rule to NOT run if the url has /Users or /Forums in the url. How can I do this? Upda...

PHP dynamic URL writing to accommodate dynamic menu and paths

I'm trying to figure out what the best way to go about rewriting urls to accommodate not only a directory structure, but appended actions for a menu for a site I'm building in PHP. I have one page that dynamically loads content based on whatever "page" is being loaded. Includes are pulled based on what the page is. Right now that's tied...

Mod rewrite issue with https, strip www from url

we have a url for eg https://www.egdomain.com/ and the ssl is valid for egdomain.com. so how can i redirect all the requests from https://www.egdomain.com/ to https://egdomain.com/ the site also has normal http requests which works fine. I tried the htaccess below but still nothing RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] Rewrite...

htaccess question: Remove 1(!) param from URL query

Hi, my URL looks like page.html?L=0&a=1&b=2&c=6 OR page.html?a=1&b=2&L=0&c=6 OR page.html?a=1&b=2&c=6&L=0 I need to delete the L=0, where L can be either 0 or 1. But I need to keep all other params. How can this be done? ...

Why won't this simple RewriteRule work?

Hi All, This should be simple but I cannot figure it out. I have this very simple mod_rewrite rule and it just doesn't want to work. This is the entire contents of the .htaccess file. RewriteEngine On RewriteRule ^([A-Za-z0-9-_/\.]+)/?$ index.php?page=$1 [L] If I call the URL domain.com/foo it should rewrite it to index.php?page=foo....

htaccess mod rewrite - how to create virtual subdomains?

Hi, I would like to create virtual subdomains through htaccess in the following way. Entering: http://testuser.domain.com/1/2/3/ Should be processed as: http://www.domain.com/user.php?id=testuser&amp;var1=1&amp;var2=2&amp;var3=3 HOWEVER, this rewrite should not use user.php, but index.php, in case someone enters: http://www.dom...

mod_rewrite: remove query string from URL?

Hi There, I'm trying to make the following redirection (301) using .htaccess *?page=1 redirects to * (where * is a wildcard). Basically, I just want to prevent anyone accessing a page with ?page=1 at the end of the URL, and instead direct them to the same url minus '?page=1'. Is there a quick way of doing this? Many thanks! ...

Is it safe to use mod_rewrite B flag?

Hi, According to Apache bugtracker, the B flag was fixed in version 2.2.9 https://issues.apache.org/bugzilla/show_bug.cgi?id=45529 How safe is it to use this B flag? If I include it in the next release of our software, can I rest assured that the majority of hostings will work fine with this? ...

Django, subdomains and mod_rewrite. URLs messing up on deployment setups.

I have a Django application being served of (say) example.com. It contains a number of sub-applications (say) strength, speed and skill. The URL scheme is something like http://example.com/strength, http://example.com/speed and http://example.com/skill. This is how I run my dev server (using runserver) and there are no problems whatsoeve...

Remove IP address from Query String using HTACCESS

I have a URL like so: http://example.com/one/?ACT=123&amp;gateway=mygateway&amp;method=mymethod&amp;orderID=303&amp;currency=EUR&amp;amount=11&amp;PM=CreditCard&amp;ACCEPTANCE=test123&amp;STATUS=9&amp;CARDNO=XXXXXXXXXXXX1111&amp;ED=0517&amp;CN=Test+test&amp;TRXDATE=08%2F12%2F10&amp;PAYID=7963938&amp;NCERROR=0&amp;BRAND=VISA&amp;ECI=7&a...

Create SEO-friendly URL with PHP with just the Querystring Value

Is there a way use mod_rewrite to produce the result below? Original URL: http://www.domain.com/shop.php?id=newyork to SEO friendly URL http://www.domain.com/newyork I've seen plenty of example where the above URL can be converted to http://www.domain.com/shop/newyork but I actually don't want to display the word 'shop/' so just http...

mod_rewrite N number of directories before URL

Hi There, I want to redirect users from a URL formatted like this: http://blog.mysite.com/any/number/of/directories/&lt;POSTNAME&gt;.html TO: http://mysite.com/about/blog/entry/&lt;POSTNAME&gt;/ Where is the same hyphen-separated string, and, the original URL can have any number of directories before the filename (none of which a...

Is It Possible to Alter the Displayed URL from the Actual URL?

I posted a question the other day about how to change the displayed URL on a Wordpress-generated page, specifically from something like "mysite.com/?cat=3" to just "mysite.com". I got a few replies that steered me towards doing some type of redirect with .htacess. After some research and experimentation, I realized that it's not so muc...

Rewriting a domain name so it is handled by a different server binding... Is it possible?

I would like to rewrite a subdomain so it is passed as a querystring to a site. Take the following scenario. IIS Config: Site A (bindings: *, site-a.com) Site B (bindings: site-b.com) Rewrite rules: "sub1.site-a.com" -- rewrite to -> "site-a.com" "sub2.site-a.com" -- rewrite to -> "site-a.com" "sub1.site-b.com" -- rewrite to -> "site-...

mod_rewrite URL rewriting with or without Slash

What is the correct way to write out the .htacess so that both www.domain.com/about_us and www.domain.com/about_us/ goes to www.domain.com/about_us.php Currently, what I have is the below and just wonder if there's a way to put it in one line Options +FollowSymLinks RewriteEngine on RewriteRule ^(about)$ /about_us.php RewriteRule ^(abo...

Rewriting with Apache

Hey all, I have this setup .. /plain index file /sub_dir1 /sub_dir2 (<-subdomain) /sub_dir3 /blog (<-wordpress) /etc/ but want this .. /wordpress /sub_dir1 /sub_dir2 (<-subdomain) /sub_dir3 /etc/ Is this possible with wordpress' rewrite rules etc? Any advice on the Apache rules? Cheers, Jeremy ...

htaccess / mod_rewrite problems with possible subdirectories.

Hi! I am working on a very dynamic system where i have two identical htaccess files in / and in /somepath. The reason for this that the domain could be pointed into /somepath, but i never know if it is. When it is pointed to /somepath there are no problems, but when its not it seems like when i request /somepath/page/foo/bar the htacc...

could somebody explain to me how to use mod_rewrite to create pretty permalinks like wordpress does?

i am writing a site from scratch using php/mysql and am using GET requests to pass data between the pages. at the moment my links look like: http://pkh:55/?service=213971&amp;type=FSD but i would like to use mod_rewrite to make them more relevant, ie: http://pkh:55/FSD/services/football-youth-club/ i've had a look through the word...

Basic Static-to-Static Rewrite (or Redirect) via htaccess or httpd.conf

We are moving from one site language/CMS (coldfusion/custom) to another (PHP/Drupal) and need to have some of our old pages redirected to new ones. I have access to both the .htaccess and httpd.conf (and apache2.conf) as this is a vps on Linode. Most of them cannot be done via regular expression (they contain GUIDs in the URL) and we're...

htaccess redirect to a folder...

I wasn't sure what the title should be but its s simple concept but I'm useless with .htaccess rewrites. I currently have: RewriteRule ^([a-zA-z0-9_-]+)/?$ index.php?page=$1 which will happily send all requests to my index and I can do what I want. I have: RewriteRule ^events/([a-zA-Z0-9-./]+)/?$ index.php?page=events/index&id=$1 ...