mod-rewrite

help with rewriterules

I need help rewriting online.php to -> /users/online and profile.php?id=3426 to -> /users/3426 and users.php to -> /users Would this be possible? And is there any good mod_rewrite cheat sheets out there? ...

url rewriting index.php

i have urls like http://mysite.com/index.php?p=resources http://mysite.com/index.php?p=resources&s=view&id=938 but i want urls like http://mysite.com/resources http://mysite.com/resources/view/938 instead of making hundreds of rewrite rules i wonder if it would be possible to just have one? Ive head this is possible by "get...

How can I use mod_rewrite to redirect children pages/directories to a parent directory?

So I have a whole series of redirects in place for a bunch of pages I want redirected to their parent directory (e.g. /faq/question1/ -> /faq/), but it's very inflexible, as they're manually generated. How can I set up a RegEx-fueled RewriteRule for this? I haven't been able to figure it out, and would dearly love some guidance. Here's ...

configure mod_rewrite to allow img, js and css files?

in my .htaccess i've got these lines: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L] i tried to include js files with this line: <script type="text/javascript" src="system/application/media/js/jquery/jquery.js"></script> but it doesnt work since the rules dont let it pass. it w...

VisualSVN Server RewriteRule/Redirect Apache

Hi, Relating to another question I asked regarding setting up Mercurial under VisualSvn server. Currently when you go to the /svn/ url you can see all repos including hg repos. I now want some way to redirects you to the correct url for hg repos Eg myserver/svn/MecurialRepo => myserver/hg/MercurialRepo Or the correct hg script is run,...

General RewriteRule for many undefined parameters in URL

I'm trying to write a rule to make that one can generalize, since multiple pages to pass the values are different. Right now I could do: RewriteRule ^forum/([^/]{1,255})/([\+]{1})/((([a-z]+)([_]{1})([a-zA-Z0-9]+)([/]?))+)$ forum.php?name=$1&$5=$7 [L] To address such as: Nome+del+Forum/+/page_1/action_do Should return: forum.php?...

apache rewrite rule to flow requests for all .php files to a specific file

I'm working on a simple website. I'm using a template file (template.php), which has all the shared HTML, and accepts a parameter (say 'page'). then opens the page file and includes the page in itself. something like this: (the code is just a prototype. no validation/filtering is required). <?php //template.php ?> <html> <body> ...

Apache mod_rewrite - prefer files over directories with pretty URLs

I want to have pretty urls so http://www.domain.com/foo will return http://www.domain.com/foo.php The issue is that there is a directory that has the same name. I have another page at http://www.domain.com/foo/bar/baz and right now my server just returns the directory listing of foo when I request http://www.domain.com/foo Pseudocode: ...

htaccess mod rewrite files to go through php first?

I have a directory full of files. Originally people were allowed to direct link to these files. Now i would like to run all files through a php file first. Could someone help me with the .htaccess needed to do that? The phpfile used to handle the downloads will be called download.php and it will have a get variable called $ref So i ne...

Wordpress htaccess in root overriding htaccess in subdomain. Subdomain app not working now.

Hello, We have a WP install in the root of our server and its running great.. but, we just installed another app in a subdomain. Now, I can view the index.php of that app but cannot do anything with it.. the htaccess rules in the root (from WP base install) are effecting the requests. So, how to I eliminate the WP htaccess file from eff...

mod_rewrite to change my urls

Hi, I've been fighting with mod-rewrite for a while. Basically, I have a website that I'm moving to a difference namespace/directory. What I'd like to do is change urls that look like this: http://mydomain.com/index.php?a=xxxxxxxxxx These urls will always have "index.php?a=". I have a different/new site that also has an index.php fi...

htaccess mod rewrite NOT

Hi, I have a small problem with url rewriting on apache. I would like it that it ignores the admin/ folder from rewriting. Options +FollowSymLinks RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?cat=$1&name=$2 [L] RewriteRule ^([^/]*)/$ /index.php?cat=$1 [L] I have triend doing it myself but I can't figure it out. Thanks. ...

mod rewrite escape chars

hi, simple question, my url is www.site.com/page--3 I need the rewriterule to read "/page--3" as two different values. I have this working: RewriteRule ^/?([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ index.php?page=$1&subpage=$2 This gives me the values 'page' and '3' from www.site.com/page/3. how do i get the rewriterule to read the '--' as ...

Mixing .htacess wildcard and cpanel pointed subdomains gives 500 internal server error for any subdir of the pointed subdomain

On my site, I've got Wordpress in www.mydomain.co.uk, I've got a search engine on find.mydomain.co.uk, and I've got subusers on a wildcard with a script in a subdirectory to work out what to serve, based on the subdomain. In cpanel, I have, for the subdomain redirect: *.mydomain.co.uk /mydomain find.mydomain.co.uk /mydomain/find in...

Rewrite a dynamic URL to a new dynamic URL

I am new to the RewriteEngine and have not been able to find an answer to the following issue. I run an ecommerce site with an ever changing catalog of product skus. Our URLs are dynamic. The question is, what if I want to have a dynamic variable redirect to a different dynamic variable. For instance, I want: http://www.mydomain.com/pr...

Checking if file exist with RewriteCond in a chained RewriteRule

Hello, I hope you could help me here. I have a RewriteRule which gives you a crossdomain.xml file depending on the domain name. I have it in a way that ignores the ".dev." string in the middle, example: Request: http://site1.dev.mydomain.com/crossdomain.xml Returns file: /etc/httpd/conf/crossdomain/site.mydomain.com.xml RewriteCond %...

Isapi Rewrite : Remove filename from URL

Hi there Im am trying to use the isapi rewrite tool on my web domain to write some basic rules, but am getting a bit confused. My base url is http://forevr-dev.co.uk/musicexplained/index.cfm and every page on the site follows from this base url. For example http://forevr-dev.co.uk/musicexplained/index.cfm/artist/blondie would be the ar...

URL Rewriting from a subdomain to main domain!

Hello. I am developing a pretty large website for a client, and its about 90% complete. It is currently hosted on a subdomain like so: now: v2.websitehere.com when complete: www.websitehere.com My problem is that SO much of this site is linked to the temporary subdomain. The newsletter service, multiple google apis, etc. I als...

RewriteRule being greedy

I have been looking for an answer for a few hours now, so sorry if this was asked a ton of times, I missed it. I basically want to make a rewrite to ignore the first directory. That first dir in the path will be different so I thought I could use a regex. But my regex is matching all the way to the file name: RewriteRule ^([a-z]+)?/(.+...

Implementing Google Crawlable AJAX URL's with Mod Rewrite

I'm looking to implement the Google crawlable AJAX states as described here: http://code.google.com/web/ajaxcrawling/docs/getting-started.html Essentially this requires specifying your AJAX states with a #!state value at the end of the url. This should then be passed to the application server (PHP in my case) as part of the query stri...