mod-rewrite

.htaccess redirection

Hello I want to have some redirection made by .htaccess file: Some examples mysite.com/accepted -> mysite.com/index.php?type=accepted mysite.com/waiting -> mysite.com/index.php?type=waiting mysite.com/cancelled -> mysite.com/index.php?type=cancelled & mysite.com/edit/2 - > mysite.com/admin.php?edit=2 ETC. for all numbers possible ...

RewriteRule to disregard a url variable

I have some pages indexed by Google, for example: /product.html?affiliateid=142 I want a rewrite rule to 301 redirect to the same page if there's an affiliateid=xxx So far I have this: RewriteCond %{QUERY_STRING} ^affiliateid=[0-9]+$ RewriteRule ^$ /test.html$ [L,R=301] But its not working, I need to get rid of the variable and g...

Need help with Apache Rewrite issues

Hey guys, My developer has provided me some Apache rewrite rules that are required for our application to work. When I added them to Apache my www.domain.com/blog and www.domain.com/phpmyadmin pages no longer worked. I tried to add the first RewriteCond rule for my blog and also the final phpmyadmin rule but neither one is working as e...

switch mod rewritten URL

We are using a mod rewritten URL within our PHP site, this is the rewrite rule we are using: RewriteRule ^category/([^.]+)/([0-9]+)/([^.]+)/([0-9]+) categories.php?c_id=$2&filters=$3&_p=$4&area=category&areaname=$1 However, a user of a different system is switching to our setup and wants to 301 all their old pages to their new equival...

Apache RewriteRule with RewriteMap

I've got a RewriteMap that looks like this: Guide 1 Mini-Guide 2 White Paper 3 and I'm including it into Apache via RewriteMap legacy txt:/var/www/site/var/rewrite_map.txt I want to create a RewriteRule that will allow only values from the left side of said RewriteMap to be in this position; RewriteRule ^/sectio...

HT Access - Mod Rewrite

If i use: RewriteEngine On RewriteRule ^.* controller.php It would send all requests to controller.php But if controller.php included a css file (/assets/css/main.css) then it wouldn't work, as when the browser called it, it would just redirect to controller.php Is there a way i can fix this? ...

mod_rewrite send everything not matched to a rewritemap

Hi, I have an htaccess file which begins with the regular stuff: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d then has a few rewrites eg: RewriteRule ^protect/?$ /Legal/Your-Financial-Protection.aspx [NC, L, R=301] then ends with a rewritemap: RewriteMap map txt:rewritemap...

mod-rewrite spellbook

Most online guides I've found are lengthy, boring, insufficient, or otherwise lacking. Where can I find a guide that explains mod-rewrite extensively, yet concisely? (The above question sprouts from the following sentiment:) I'm not satisfied with simply copying and pasting the magical incantations that make my .htaccess files do my bid...

codeigniter installation problem on shared host

my host account is something like: ~ ~/public_html ~/public_html/system/application to access my web, I need to put http://example.com/~userid in address bar I install codeigniter in the ~/public_html directory, I can access http://example.com/~userid. The Welcome page shows correctly, and the related user guide pages show correctl...

Apache rewrite condition and the absence of characters

We have the following mod_rewrite condition/rule but it is returning a 404 error on URLs that merely begin "i" (or "css" for that matter) if they do not equate precisely to our corresponding directories (/i /css etc.) RewriteEngine on RewriteCond $1 !^(index\.php|robots\.txt|/(i|css|design_and_docs|js|test)/*) RewriteRule ^(.*)$ /index....

rewritemap not matching

Hi I'm having trouble with my rewritemap not matching things: RewriteMap map txt:rewritemaps\map.txt [NC] RewriteCond ${map:$1|NOT_FOUND} !NOT_FOUND [NC] RewriteRule ^(.+)$ ${map:$1} [NC, R=301] The map has about 4,500 entries, including: arctic /Destinations/Polar-Regions/The-Arctic.aspx My RewriteLog, set to level 9, logs: i...

Ending with period using Mod Rewrite

I would like to know how to allow periods at the end on my url's. Currently if I had the url: http://www.mydomain.com/Page/I.D.K. The page grabbing the information would return Title: I.D.K (Without the ending period) This also happens with other punctuation and it is effecting my pages displaying information wrongly. Thanks for look...

Problem with .htaccess, rewrite rule.

Hey guys! I have a page with a RewriteRule that makes my code: /?p=page will be rewritten like: abc.com/page, but I really want to have more sites under that, and at the moment I have this code in my .htaccess file. Right now I have the code: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILE...

htaccess file help?

I need to install Expression Engine on a subdomain for a client, and he is already running a php-based program on the main domain. Whoever set up the database program on the main domain apparently needs all .php extensions removed, but this makes it so that I can't even run the install for Expression Engine because of the rewrites in th...

Content Fetching Using htaccess

Let I have two domains named www.abc.example and www.xyz.example hosted in different servers. I have a .htaccess file in the root directory of www.abc.example (i.e. www.abc.example/.htaccess) What will be the .htaccess script if I want to load the contents of www.xyz.example when I request from www.abc.example. As for example: If I br...

Help with .htaccess RewriteRule. Need to take user from one URL to other.

I want users who type http://www.example.com/word-of-the-day to be taken to http://www.example.com/index.php?page=word-of-the-day But I want http://www.example.com/word-of-the-day to be shown in the URL for the user. What should I do in my .htaccess? I tried but the regular expression and the syntax of RewriteRule is way too c...

What is the best way to implement a controller in PHP?

In the last couple of websites I made, I implemented a kind of MVC-style controller, I think. I used mod_rewrite to send everything through index.php, so the url became a querystring. It worked, but I'm wondering if it's a bit hacky, or just the accepted way of doing things. Is there a better way? I don't want a framework, I want to le...

Code Igniter SubDirectory Question

I am trying to let the "trac" directory and all of it's subdirectories be accessible through the url http://www.domain.com/trac/ I am working with the codeginiter framework and my directory structure looks like .htaccess index.php system trac I can access the abov url fine, but the problem is the scripts and other files contained in ...

IIS7 URL Rewrite Mod causes unwanted effects

This might be more a a regex question, but it is holding up our release. I'm unable to come up with a clever solution. Basically, we want to rewrite www.oursite.com/Games.aspx?g=classic&m=etc to www.oursite.com/classic/?m=etc The problem is that the rule itself (at least as generated by the URL Rewrite mod for IIS7) looks like this: <...

.htaccess RewriteRule so user views site.com/folder but is served site.com/f1/f2/f3/folder/index.php

I am trying to figure how to make a .htaccess RewriteRule so a visitor views: site.com/folder but is served site.com/f1/f2/f3/folder/index.php where f1/... is just an arbitrary line of folders. Have kicked mod_rewrite a little, and got some really weird results, none I was going for though. Any help wrapping my head around this is...