.htaccess

mod-rewrite URL Change

I had an issue playing with Gallery when I changed a setting. However, I noticed there is a pattern to the error: The URLs look as such: main.php/d/number/name.jpg "number" is dynamic (ie "9496-2") "name" is dynamic (ie "all+clad+7pc+b") Everything else is static. Unfortunately, when I made the setting change, the "number" portion t...

Removing index.php from website URLs

I am using the Kohana framework (but I think it's irrelevant for this question) and pages can be accessed like so http://www.example.com/articles/ http://www.example.com/index.php/articles/ Now, as a rule of thumb, I generally try and tweak my .htaccess to only allow one way in for a page, and silently redirect other common ways. Ess...

.htaccess Edge Case

I am using these rules and conditions in .htaccess to turn these http://www.example.com/index.php/about/history http://www.example.com/about/history/index.php into http://www.example.com/about/history .htaccess # ensure there is no /index.php in the address bar RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/ R...

Why does this config code not work in .htaccess?

<VirtualHost *:80> DocumentRoot /lf/main/com ServerName 74.220.215.241/~laborfa2 ServerAlias 74.220.215.241/~laborfa2 RewriteEngine on #RewriteLogLevel 2 #RewriteLog logs/rewrite.log RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.php -f RewriteRule ^/(.*)(/?)$ /$1.php [L] RewriteRule ^/([a-zA-Z]+)([a-...

.htaccess ModReWrite help

I am having some trouble with my ReWrite code. Please note that the .htaccess file is in the subdomain folder (...public_html/subdomain/ ) I am simply trying to rewrite a page request: http://subdomain.mysite.com/home http://subdomain.mysite.com/index.php?page=home My .htaccess file looks like this... RewriteEngine On RewriteRule ^/...

How to prevent access to wordpress blog by ip?

I am having problems as some computer from an IP address is trying to access all the files on my server. How should I change the htaccess file so that IP address gets NO access at all to any files? And which htaccess file do I change? It looks like I have one inside each folder. ...

Q2:Why does this config code not work in .htaccess?

What I will use instead of Document_Root in .htaccess?? Following is in my htttp.conf of my linux server. RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.php -f RewriteRule ^/(.*)(/?)$ /$1.php [L] RewriteRule ^/([a-zA-Z]+)([a-zA-Z0-9_]{3,15})(/?)$ /profile.php?fairid=$1$2 [L] RewriteRule ^/([a-zA-Z]+)([a-zA-Z0-9_]{3,15})/([a-z]*)(/?)$ ...

.htaccess Rewrite Question

I have a number of pages in my site, as one would expect. For example: index.php submit.php view.php?id=blah I want these rewritten like index/ submit/ view/blah Whats the best way of doing this? ...

Strip specific parameteters when redirecting with Mod-Rewrite

I have a pretty complex RewriteRule where I need to check if certain parameters are present in QueryString and then redirect to the same URL but with those parameters stripped. How can I remove some parameters and preserve the rest? RewriteCond %{QUERY_STRING} color=red RewriteCond %{QUERY_STRING} status=contiue RewriteRule ^(.*)$ /$1?...

How can I set up a reverse proxy with mod_proxy without redirecting?

How can I set up a reverse proxy with mod_proxy without redirecting to another server or IP? This will be a virtual host environment. The reason I want to do this is so that mod_proxy handles the communication with the client's browser thereby freeing up web server processes to serve the next request instead of feeding the client's brow...

How to use htaccess to redirect all but one subdirectory

It's been a while since I've messed with .htaccess and I can't seem to get this quite right. I have a site, say example.com, where I want example.com/* to redirect to example.com/collector.html except for URLs under the subdirectory example.com/special, which I want to continue working. For example: example.com/page.html should redire...

Integrating Ruby Handler With Apache

If you use Webrick you can implement a servlet and service http requests using ruby. Now I have code that does everything that I want but I would like to move to Apache. Is there a way to modify the .htaccess file to send all the requests through a ruby handler? ...

Redirecting a Directory to a Script on Apache

So I'm playing with a script that makes it super easy to mirror images off of the web. The script works great (based off of the old imgred.com source, if you've seen that) problem is, it looks a little clunky when using it. Currently, in order to use the script, you go to a url like: http://mydomain.com/mirror/imgred.php?Image=http://o...

.htaccess Question

I have a login script using PHP. The variables for login in and out are log.php?do=in and log.php?do=out I would like to change this to log/in and log/out if possible. Im really struggling to understand .htaccess and the rewriting at the moment ^^ ...

.htaccess - Pretty User Profile URLs

I want to make my user profiles 'pretty' as it were. Here is the regular URL: user.php?user=UserName I want this to become: user/Username Please help :) Im a .htaccess newbie. ...

Rewrite rule not working

I've done the first steps in Zend Framework with akrabat.com/zend-framework-tutorial/. The Demo-App works fine, but the CSS. I think my rewrite rules are wrong. All hrefs looks like: /~cm/zf-tutorial/public/index.php/index/edit/id/1 /~cm/zf-tutorial/public/index.php/css/site.css The .htaccess is: RewriteEngine On RewriteCond %{REQU...

How do I conditionally add a line to Apache .htaccess based on the domain?

My local development PC is set up to use PHP5 by default, my client's host (1and1.co.uk) is set up to use PHP4 by default. To enable PHP5 on a 1and1 account, you must add the following line to your .htaccess file: AddType x-mapp-php5 .php If I add this line to my local .htaccess file, it breaks my PHP. How do I add this line conditi...

How can I store my Rewrite Rules in a database?

Hey everyone, Im developing a new site, and I'd like to store my rewrite rules in a database, instead of right in the .htaccess files. I have another site that uses Opensef (http://sourceforge.net/projects/opensef/) with a Joomla! installation that is doing this, but im not even 100% how it works underneath the hood. How can I store t...

RewriteRule with onClick problem

Hello, I have a RewriteRule in my site and it's working fine but 1 part of my javascript doesn't work. <a href="#" onClick="check('1')">Click</a> <div id="1" style="padding: 5px; display: none;"> MyText </div> normaly i had www.mysite.com?page=home and when i click it work like www.mysite.com?page=home# but with the RewriteRule...

Problem using URL rewrite (Relative Paths not working)

Hi I am using a .htccess file in order to rewrite my URLs. I am using the following rules in my .htaccess files Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^product/([0-9]+)/([A-Za-z0-9+]+)$ /product.php?productid=$1&prodname=$2 The rewrite worked fine. But when i try to access any other page through relative...