FTR, I'm pretty abysmal at rewrite rules.
We've got a number of users who each have their own projects. Right now we've got the RewriteRules set up so that when someone just types mysite.com/username it goes to the user's profile at, f.e., mysite.com/work/user_name.php?u=000
But what we really need is, when someone types in mysite.co...
Hey Guys,
As the apache docs state:
"The configuration directives found in a .htaccess file are applied to the directory in which the .htaccess file is found, and to all subdirectories thereof."
Which means that a rewrite in the root .htaccess affects all other folders in the website correct? That is what I've always thought, and have ...
Hi,
I've got a really simple question.
I want to redirect all requests to http://localhost/home/ and http://localhost/home to home.php
My .htaccess file contains:
RewriteRule ^home/$ home.php [L]
which only works for http://localhost/home/
How can I make it work without the /in the url too? Is it possible to do it in one line, as o...
Im trying to forward this url, but its not working - here is my code:
RewriteRule ^https://www.wsjwine.com/discovery_offer.aspx?promo=2227006$ https://www.wsjwine.com/discovery_offer_lp2.aspx?promo=2227006 [L]
...
I have a couple of rewrite rules in htaccess. They work on one server but not another. My script is as follows (I've commented out how the urls look):
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/images/
#example.com/regions/fife/
RewriteRule ^regions/([A-Za-z0-9\-\+\']+)/?$ /regions.php?region=$1 [L]
#example.com/regi...
I am trying to implement some Apache rewrite rules to set the MIME type (in)correctly for XHTML in Internet Explorer. I have found these rewrite rules in many place, and they seem to work for most people:
RewriteCond %{HTTP_USER_AGENT} .*MSIE.*
RewriteRule .* - [T=text/html]
However, my site is already using Rewrite rules with the...
I did some looking around at how other sites might handle this and didn't really see anything that jumped out at me. I'm working on a project where you can create pages that get linked to from every other page. Here is where the issue is coming up for me.
I'm not sure how I should go about linking to these pages. I've only really though...
I'm trying to use mod_rewrite to handle an unknown number of variables.
An example URL would be:
example.com/var1-var2-var3/title
I have this so far:
RewriteRule ^([^/.]+)-([^/]*)(.*)$ $3?version[]=$1&version[]=$2 [QSA,N]
RewriteRule ^([^/.]+)/?$ ?title=$1 [QSA,N]
RewriteRule ^/?$ /index.php [QSA,L]
This returns:
Array ( [title] ...
I'm developing my first decent-sized PHP site, and I'm a bit confused about what the "right way" (assuming there ever is such a thing) to handle clean/friendly/pretty URLs in the application.
The way I see it, there are two main options (I'll use a simplified social news site as an example):
1. Use mod_rewrite to handle all potential U...
Let's say I want to support urls like twitter where:
twitter.com/username redirects to twitter.com/user_name.php?user=username
I have the following
RewriteRule ^(.*)$ user_name.php?user=$1
And that works fine. But the problem is now that everything, including twitter.com/index.php will of course redirect to user_name.php
How can I...
I currently have links on my website in the form of:- http://example.com/products.php?cat=X
I want that once taken to the destination of the link, the url displays something like:- http://example.com/new.
The file on my server is the same file, but only the url should appear neater without me having to change any of the links.
I tri...
I am passing one of the following URLs to a site an want it to split into the proper parameters.
http://example.com/storevar?search_term
http://example.com/storevar/?search_term
http://example.com/storevar
http://example.com/storevar/
http://example.com/storevar/search_term
http://example.com/storevar/search_term/ ...
how i can delete .php from url with mod_rewrite?
for example:
test.com/index.php -> test.com/index/
test.com/contact.php -> test.com/contact/
tanks a lot
...
I've got a problem with rewriting a URL to a fastcgi dispatcher. If I leave only:
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L,QSA]
I expected L (last rule) to cause only a single rewrite. Instead, it keeps prepending dispatch.fcgi until apache reports an error.
I know it can be fixed with:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ...
I've got a url type:- http://www.example.com/products.php?cat=1 which I am able to rewrite to:- http://www.example.com/myproduct1 using the following .htaccess rule:- RewriteRule ^myproduct1$ products.php?cat=1.
What rule would I need to enter if I wanted to rewrite to:- http://www.example.com/myfolder1/myproduct1/?
...
Hi,
I have the following in my .htaccess file:
php_flag magic_quotes_gpc off
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^admin(.*)$ admin/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
The idea is...
The Scenario
I have completely rewritten an old existing ASP classic ecommerce website over to PHP.
The database design of the previous site had alot of relational ID problems causing troublesome linking of product data rows to other tables in the database.
To get around this I also redesigned the database, giving products new Primary ...
Thanks to everyone who has helped me with my clean URL quest. I'm almost there but want to lick this last thing.
.htaccess
RewriteEngine on
#REMOVE THIS LINE ON SITE LAUNCH!
RewriteBase /~accountName/
#Hide .php extensions for cleaner URLS
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ ...
From development to testing to production our website resides in three different environments
http: //localhost/version/
http: //www.production.com/test/
http: //www.production.com/
(see examples of URLs in the following .htaccess snippet)
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^brand/(.+) /products.php?brand=$1 [R,NC]...
Hello,
I am looking to permanently redirect all the pages on a domain to one page on the SAME domain, using htaccess/mod_rewrite.
Basically I want any page requested for the domain to return a holding page [ which is index.php] at domain.com/
most of my attempts so far are causing errors as they are throwing the server intoa loop.
T...