On the one hand mod_rewrite allows me to make userfriendly urls redirecting requests to proper script but on the other I can't use relative links because they will point at nonexistent files.
A little example:
mod_rewrite redirects request
http://site.ru/param/one/page.html
at http://site.ru/script.php
while I have "myimg.jpeg" file at t...
Here's what I have now:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)(.*)$ /$3?$1=$2 [N,QSA]
This turns www.any.com/x/20/y/30 into www.any.com/index.php?x=20&y=30
(while ignoring existing directories - thank you so much Gumbo!!)
RewriteRul...
I have several rewrite rules in my .htaccess file that all work fine and I want to add a specific case to turn
sinaesthesia.co.uk/category/psoriasis
into
sinaesthesia.co.uk/category.php5?category=psoriasis
So I tried:
RewriteRule ^(.)category/(.)$ /$1category.php5?category=$2 [L]
which doesn't work. I've tried it without capturing...
Hi there,
I'm trying to do something pretty simple in iirf.
I want all requests that are missing the www. prefix to have it added.
This is my IsapiRewrite4.ini:
RewriteCond %{HTTP_HOST} ^example\.com$ [I]
RewriteRule ^(.*)$ www.example.com/$1 [R=301,L]
This is my SampleUrls.txt:
example.com
example.com/grants
www.example.com
www...
[UPDATE]
What I ask below just isn't possible. In which case, as my brain hurts, how can I simply redirect
mydomain/folderA/folderB/name-0000.php
to
myNewDomain/folderC/folderB/name.php
[/UPDATE]
I currently have some URL's which follow the pattern below.
/folder/folder2/name-name-id.php
The content has now been moved to a new do...
I currently have:
RewriteRule ^scripts/(.*\.js) /combine.php?type=javascript&files=$1
Current scripts folder looks like:
scripts/
folder1
f1.css
folder2
f2.css
folder3
f3.css
bespoke
bespoke.css
css.ss
I would like this rule to exclude anything within the scripts/bespoke/ folder. ...
I would like to map this:
`http://www.example.com/index.php?param1=value1&param2=value2&param3=value3` (etc. ad infinitum)
to
`http://www.example.com/index.php?param1=newvalue1&param2=value2&param3=value3` (etc.)
ie. just change the value of a single parameter in the querystring. I know what the old value is, so I a...
If I am mod_rewriting a URL from:
http://www.mysite.com/blog/this-is-my-title/1/
to
http://www.mysite.com/blog.php?title=this-is-my-title&id=1
...is it possible then to arbitrarily attach a get value on to the URL later, or does the mod_rewrite throw it off?
MY REWRITE RULE:
RewriteRule ^blog/([A-Za-z]+)/(0-9]+)/? blog?ti...
I've got a large set of rewrite rules like the following:
RewriteRule ^foo foo.php?blah [L]
RewriteRule ^bar foo.php?baz [L]
And then I have a sort of catch-all rule that I want to only apply if the above rules don't match (e.g. for, say /blatz). As long as I remember to include the [L], that works fine -- but I've already had issues...
I'm a mod_rewrite noob and I'm getting a headache trying to figure out something that should be simple. What I'm trying to do is strip out unwanted variables from a URL displayed after a GET form is used. In other words, I'm trying to change this:
stats.php?gender=W&team_id=88&btnGet=Get+Stats
to this:
stats.php?team_id=88
Please...
hi,
im pulling my hair out.
im utilising mod_rewrite to run through index.php if %{REQUEST_URI} isnt an existing document:
#Any request (page) which doesnt exist (item pages, special urls, categories etc)
#get routed through urlparse, where PHP takes over nicely
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule (.*) urlparse...
I have publicly accessible files on my webserver. I'd like to enable AutoIndexing (Options +Indexes) but I'd like to require a password in order to view these listings. I have no problem setting up the Auth but there are complications with the public files and the DirectoryIndex files in that if someone also asks for a directory, and t...
I'm wondering, if I have an .htaccess rewrite setup on a virtual subdomain, ie. bm.example.com that has a rewrite to www.example.com/index.php?u=someId and I have an SSL certificate on www.example.com, will I run into problems if I try and access https://bm.example.com?
...
I am moving my site to new domain. Need to redirect pages
from
old-site.com/oldpage.php?id=X
to
new-site.com/newpage-X
(X is number)
Why this rule does not work?
RewriteEngine on
RewriteRule ^oldpage.php?id=(.*)$ http://new-site.com/newpage-$1 [R=301,L]
...
How can I rewrite the following URL:
http://www.myurl.com/job/Accounting-Clerk-at-Department-of-Workforce-Services-in-Salt-Lake-City,-UT-1b6117567108f5a2
Into these components:
query = Accounting Clerk;
cmp = Department of Workforce Services;
location = Salt Lake City, UT;
key = 1b6117567108f5a2;
To get this result:
index.php?q=$q...
RewriteCond %{QUERY_STRING} ^id=(.*)$
RewriteRule ^oldpage\.php$ http://new-site.com/newpage-%1 [R=301,L]
and
RewriteRule ^oldpage\.php$ http://new-site.com/newpage-%1? [R=301,L]
In first case result is
new-site.com/newpage-3?id=3
in second
new-site.com/newpage-3
What does question mark in second rewrite rule means?
...
Hi,
I am not a PHP developer at heart and I have been asked to perform some SEO on an existing PHP website.
The first thing I noticed was the ugly URLs so I want to get these to rewrite to something more informative. Here are all the possible patterns:
/index.php?m=ModuleType&categoryID=id
/index.php?m=ModuleType&categoryID=id&product...
I've been asked to develop a mod_rewrite to change
http://www.example.com/health-and-fitness-tips/999/
into
http://www.example.com/health-and-fitness-tips/how-do-I-lose-10kg-in-12-weeks/
where 999 is the id and How do I lose 10kg in 12 weeks is the title.
Is this even remotely possible or is mod_rewrite only for changing somethin...
I'm using the following rewrite rule, but I can't get it to work:
RewriteRule ^rates/([a-z]+)\.php$ /rates.php?c_user_action=view_type&vehicle_type=$1 [QSA,L,NC]
The URL I'm using is http://www.example.com/rates/motorhomes.php
At the moment it's just going to /rates.php without a query string.
The weird this is if I change the re...
I am facing a problem using mod_rewrite. This is what I am using
Options +FollowSymLinks
RewriteEngine on
RewriteRule pc/$ /pc.php
to rewrite http://www.example.com/pc/ to http://www.example.com/pc.php.
This is working perfectly fine but, when I go to a domain such as http://www.example.com/news/today-in-pc/ it is showing the pc.php ...