mod-rewrite

RewriteRule kindness

Hi everybody. I'm trying to setup some small layout - template framework in php - and everything is going smooth except one thing - url rewriting. I suck at regexp, and I suck even worse at mod_rewrite. And I'm in kinda hurry to get this stuff out, so can you please help me? I need one .htaccess file that has just two rules Every ...

mod_rewrite not working well with trailing slash & css breaks apart

I have just one root directory with index.php in it along with two folder img and css. I refer to files in this folder like: src="img/path.png" i.e relative to the root directory. The other day I had some mod_rewrite question & this is what someone gave me, which seems to wrok fine except for trailing slashes and css/img breaking apart ...

Force trailing slash

I'm trying to force a trailing slash to my URLs, but I can't make it work the way I want. This is my .htaccess file: RewriteEngine on #Force trailing slash RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !index.php RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ /$1/ [L,R=301] #Subdomains RewriteCond %{HTTP_HOST}...

mod_rewrite, /index.php?p=test to /test

Hello, i'm trying to set up a very simple rule in .htaccess file in order to rewrite this kind of url: www.domain.com/index.php?page=test to this: www.domain.com/test I'm newbie to mod_rewrite, and so far, i came to this rule RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ...

Removing .php extention with .htaccess not working

What is wrong with this script? The server returns a 404 error whenever I type in a url without an extention. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [NC] Does anybody have a better way of doing it? ...

htaccess help, removing a string from the URL

Hi there, I am wondering, is it possible to remove index.php from an URL? Basically on some pages in a site I have this structure, http://www.domain.com/index.php/members/register, but other pages I have URL structures like this, http://www.domain.com/category/products/id/5, I want to know is it possible with htaccess to remove the in...

Mod Rewrite - How to Rewrite All URLs With Doing Manually In .htaccess?

Hello, I'm working on a custom CMS that another developer built a few years ago. I need to change the urls to clean segment based urls from query strings. I could just add the rules for all the pages in the .htaccess file, which would be a pain as that's a lot of pages. Plus when a new page is added, obviously I won't be there waiting t...

Removing .php extention with .htaccess problem

Possible Duplicate: Removing .php extention with .htaccess not working What is wrong with this script? The server returns a 404 on whenever a link without a .php extention is clicked/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [NC] My problem is that i've been remov...

howto stop apache matching /favicon with /favicon.ico

Hello I have site running with apache mod_rewrite and php In my public_html folder i have diss .htaccess file RewriteEngine On RewriteBase / RewriteRule ^([0-9a-z]+)$ index.php?reurl=$1 this works fine if there are no files in that directory with the same name. so for example /favicon would match the file /favicon.ico and the Rewr...

.htaccess break all css and js, though i set absolute path

Here is my .htaccess file Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !=cms RewriteRule ^([^/]*)/search/([^/]+)$ index.php?lang=$1&id=search&searchword=$2 [L] RewriteRule ^([^/]*)/([^/]*)$ index.php?lang=$1&id=$2 [L] It doesn't work as i expect. ...

mod_rewrite - failing on HTTP host condition

Hi All, I'm trying to do some URL rewriting - but for some reason it's not working as I expected (I've probably missed something really simple!). I have two sites - www.domain.local and admin.domain.local. Using the below .htaccess file, the public site rewriting is fine, but the admin site isn't working as expected, as it is being pic...

Prevent url with a directory from pointing to a web page.

I have a domain let's call it newsite.com which is parked to maindomain.com. I use mod-rewrite to direct all requests for newsite.com to a subdirectory on maindomain.com. On newsite.com I have CodeIgniter installed. Which means the urls look like this: newsite.com/products/shoes/ The above works just fine. However, if I set up a con...

Help with mod_rewrite and mod_redirect

My .htaccess file is: Redirect 301 http://domain.com/news/articles?dtMain_start=150 http://domain.com/news/articles Redirect 301 http://domain.com/news/articles?dtMain_start=160 http://domain.com/news/articles Redirect 301 http://domain.com/news/articles?dtMain_start=170 http://domain.com/news/articles # RewriteEngine...

Mod Rewrite with out /old/something/else.php to /new/ and not /new/something/else.php

RewriteRule ^old/ /new/ [R=301,L] I'm having a trouble getting /old/something/else.php to rewrite as just /new/ - Currently it goes to /new/something/else.php I've tried various things I've picked up but can't seem tot find an answer to a seemingly simple problem. Any help much appreciated. ...

Remove trailing slash with mod_rewrite

I've tried every single example I could find, they all produce an internal server error. I have these rules set up (this works, no error): Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}/index.php !-f RewriteRule ^((/?[^/]+)+)/?$ ?q=$1 [L] So if it's not an existing file or ...

Mod Rewrite Question

Can anybody tell me what this does? RewriteRule .* .main.php [QSA,L] From what I understand it will rewrite ANYTHING to main.php correct? But not so sure what the QSA,L does. This is the whole .htaccess file, when I hit the main directory I get a 400 Bad Request error. Edit: Bad request went away when I added an ending slash in the b...

mod_rewrite messing up the site navigation links

On my main page, the navigation links are as follows: localhost/inventory/add localhost/inventory/view The code for those are: <a href='add'>Add Record</a> <a href='view'>View Records</a> and my .htaccess file is: RewriteEngine on RewriteRule ^([^/\.]+)/?$ ./index.php?url=$1 [L] RewriteRule ^([^/\.]+)/?/([^/\.]+)/?$ ./index.php?u...

Using apache rewrite modules without .htaccess file

hey guys, I have just completed this tutorial (and afew others) on how to use mod_rewrite with apache: http://www.workingwith.me.uk/articles/scripting/mod_rewrite however they all focus on using the .htaccess file to rewrite URLs my question is, how can you use this rewrite engine module from the apache.conf / httpd.conf files or from...

remove http auth for a specific query-string...

Hi I'm trying to achieve something like this: .htaccess: AuthType Basic AuthName "My secure page" AuthUserFile .passwords Require valid-user <Location "index.php?id=62"> Allow from all Satisfy any </Location> So the entire application should be "secured" using http basic auth, except one specific request. Is there any smart way to r...

Apache mod_rewrite usually works, but won't work in this folder -- what's wrong?

I have an Apache web server that usually handles mod_rewrite fine. I have a directory called /communications/q/ and I want to rewrite any URI to insert "index.php" before the rest of the entered URI. For example, /communications/q/something/else should actually serve communications/q/index.php/something/else. It's the standard PHP CodeI...