mod-rewrite

Apache Mod-Rewrite Primers?

I am wondering what primers/guides/tutorials/etc. are out there for learning to rewrite URLs using Apache/.htaccess? Where is a good place to start? My primary interest is learning how to point certain directories to others, and how to use portions of a URL as parameters to a script (i.e. "/some/subdirs/like/this" => "script.php?a=some&...

Apache mod_rewrite RewriteRule question

I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The bad thing about this rule is that it also matches physical directories which I don't want. How can I tell the mod_rewrite to ignore physical directories and apply the above rule only when the directory matched does not exist? Thanks in a...

Apache Redirect only when entering a password

I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is the new rule I've written, but its not working: RewriteRule ...

Do you have to restart apache to make re-write rules in the .htaccess take effect?

I have pushed my .htaccess files to the production severs, but they don't work. Would a restart be the next step, or should I check something else. ...

How to use apache's mod_rewrite rewriterule without changing relative paths

I've the following rewrite rule in .htaccess: RewriteRule ^groups/([^/\.]+)/?$ groupdetail.php?gname=$1 [L,NC] This takes something like www.example.com/groups/groupname and calls www.example/groupdetail.php?gname=groupname. And it works just fine. But all the relative links on groupdetail.php use groups/ as the relative path, and ...

Mask redirect to temporary domain with mod_rewrite

We are putting up a company blog at companyname.com/blog but for now the blog is a Wordpress installation that lives on a different server (blog.companyname.com). The intention is to have the blog and web site both on the same server in a month or two, but that leaves a problem in the interim. At the moment I am using mod_rewrite to d...

How would I go about creating a mod_rewrite that redirects to launch.php?i=/the/url/that/they/want?

So if the user types mydomain.com/dashboard, the document the server actually sends them is /launch.php?i=/dashboard. The one caveat is that I would like to leave requests for /flags /people /posters /css /icons /images /libraries /patterns alone, and they should request the actual folder. How would I create such a mod_rewrite? ...

What happens first? .htaccess or php code?

If I use mod_rewrite to control all my 301 redirects, does this happen before my page is served? so if I also have a bunch of redirect rules in a php script that runs on my page, will the .htaccess kick in first? ...

mod_rewrite for trailing slash problem

I'm pulling my hair out on what should be an insanely simple problem. We are running WebSphere IHS (Apache) through an F5 BigIP. BigIP is doing the https translation for us. Our url (changed for web, not valid) is https://superniftyserver.com/lawson/portal. When someone types in just that without the slash after portal, Apache assume...

Apache mod_rewrite to catch XML requests

How do I create a apache RewriteRule that catches any request URL ending in .xml, strips off the .xml and passes it to a specific script? http://www.example.com/document.xml, becomes http://www.example.com/document passed to script.php ...

How do I ignore a directory in mod_rewrite?

I'm trying to have the modrewrite rules skip the directory vip. I've tried a number of things as you can see below, but to no avail. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #RewriteRule ^vip$ - [PT] RewriteRule ^vip/.$ - [PT] #RewriteCond %{REQUEST_URI} !/vip RewriteCond %{REQUEST_FILENAME} !-f Rewrit...

How do I get modrewrite to not apply rules to a specific folder?

How do I get modrewrite to ENTIRELY ignore the /vip/ directory so that all requests pass directly to the folder? <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^vip/.$ - [PT] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> See also http://stackoverfl...

PHP $_GET problems with www.example.com/folder/file?id=2 type URLs

I'm changing my site to show friendly URLs like this: www.example.com/folder/topic Works fine! But when I add a parameter to the URL: www.example.com/folder/topic?page=2 $_GET stops working. It doesn't recognise the parameter at all. Am I missing something?? The parameter worked fine before using full URLs. ...

Creating a stage environment on network with port 80 blocked

I currently use my local web server to allow costumers to preview some applications and also to allow downloads of "nightly builds" of my open source library. Problem is I changed my ISP and now my port 80 is blocked. Altough I know I could easily change the port on the Apache server, I'd like to avoid that unless there's no alternati...

Explain this mod_rewrite rule

Can anyone explain what this mod_rewrite rule is doing? I'm trying to comment the file, but the code seems to state the opposite of what I think it's doing # Enable rewriting of URLs RewriteEngine on # Allow specified file types to be accessed # Thing to test = URL # Condition = not starting with RewriteCond $1 !^(index\.php|images...

SSL Certificate no WWW Apache (ModRewrite) EV

ModRewrite can easily handle stripping the www off the front of my domain. In .htaccess: RewriteEngine On RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] But with SSL...

Rewrite all queries to not need the .php extension using a mod_rewrite RewriteRule.

I'd like all queries like http://mysite.com/something/otherthing?foo=bar&amp;x=y to be rewritten as http://mysite.com/something/otherthing.php?foo=bar&amp;x=y In other words, just make the .php extension optional, universally. ...

Apache - mod_rewrite RewriteRule question

I have a few problems with my mod_rewrite rules. There a three different url pattern I want to handle. http://example.com/%module%/%view%-%args%.html http://example.com/%module%/%view%.html http://example.com/%module% The following mod_rewrite rules don't really work. Also I've the problem that the query (example: user.html?foo=bar) ...

Apache htaccess on Win2k is not being processed

I am trying to rewrite URLs using mod_rewrite. It is enabled in httpd.conf and url rewriting works if the lines are in the httpd.conf file. However, I would like the rules to be in the .htaccess file. It doesn't appear that .htaccess is being processed at all by Apache on Win2k. I have ReWriteLogging turned all the way up, but the log...

A mod_rewrite problem

Hello, I'm trying to implement the following mod_rewrite rule: host.com/developer/ => host.com/developer/index.py host.com/developer/branchX => host.com/developer/index.py?branch=branchX host.com/developer/branchX/commitY => host.com/developer/index.py?branch=branchX&commit=commitY Currently, the appropriate config section looks l...