.htaccess

301 Redirecting URLs based on GET variables in .htaccess

I have a few messy old URLs like... http://www.example.com/bunch.of/unneeded/crap?opendocument&part=1 http://www.example.com/bunch.of/unneeded/crap?opendocument&part=2 ...that I want to redirect to the newer, cleaner form... http://www.example.com/page.php/welcome http://www.example.com/page.php/prices I understand I can re...

Using altered %{REQUEST_URI} in RewriteCond file exists check

Hi there, I'm wanting to take a URL such as http://localhost/universe/networks/o2/o2_logo.gif and do the following: If it begins with /universe/ Strip /universe/ from it to become /networks/o2/o2_logo.gif Check if this exists in %{DOCUMENT_ROOT}/networks/o2/o2_logo.gif If so, silently rewrite the request to this file. If I use a rul...

Creating SubDomains to Absolute Paths with .htaccess

Hey, My host is absolutely terrible. For some odd reason creating a subdomain in cPanel simply does not work, and their support lines are always busy. I thought I could get around this by using .htaccess. I'm sure it's not that hard, but I'm kind of new to mod_rewrite and have had little success searching in the last 5 hours. Heres ...

How do I write an .htaccess rewrite rule to convert query strings into segmented URIs?

Is there a way to put a rewrite rule in htaccess that will convert query strings to segmented URIs? For eg. http://domain.com/controller/method/?a=1&b=2&c=3 should get rewritten as http://domain.com/controller/method/a/1/b/2/c/3 All there is to do is remove the ? and replace the &s and the =s with a /, but I'm not quite su...

using .htaccess for REST does 301 redirect

I'm trying to build an extremely simple RESTful test rig for an app I'm working on. I'm using .htaccess to redirect urls to my controller script where I will parse the urls to handle the logic. I have the redirect working, but the problem is that if I do a POST/PUT/DELETE, Firebug shows my requests going to the test rig properly, but I...

How do I 301 redirect one domain to the other if the first has a folder path

I want to 301 redirect from: www.olddomain.com to the root of newdomain.com but I want it to work no matter what the folder path is on the old domain. eg: the following should all redirect to the root of newdomain.com www.olddomain.com olddomain.com www.olddomain.com/folder/file.php olddomain.com/folder/file.php How can I do that with...

URL rewrite using mod_rewrite in .htaccess

Hi, I am trying to rewrite the URL using the mod_rewrite apache module. I am trying to use it as below : Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^wants/testing.htm wants.php?wantid=$1 [L] I have created a .htaccess file in the directory from where the files are accessed. The mod_rewrite is also enabled. W...

.htaccess file redirect if not exists, remote file upload

Server A - application Server B - static media from uploads, no app App on Server A processes the upload, validates and posts a job to convert it, after the conversion it's moved to Server B via copy (mounted drive) . Then the media file is loaded via a player on the page on Server A. I want to load the file via the remote url http:/...

mod_rewrite URL info required

I am new to this mod_rewrite. I have been successfully able to rewrite the URL something like this: "http://mydomain.com/products/12" to "http://mydomain.com/products.php?prodId=12" But when I give http://mydomain.com/products/12 in the address bar... the css and js files are not loaded. But when I access "http://mydomain.com/products...

Protect Plesk login page from search engine eyes

Hi Folks, I was wondering if would it be possible to protect the "https://www.DOMAIN.com:8443" URL from search engines listing perhaps using the htaccess to redirect the 8443 port from "DOMAIN" to elsewhere? This is the VZPP Plesk - Login Login to Plesk. Please enter your login information. Username. Password. Interface Languag...

.htaccess mod_rewrite playing with variables

I want to have my site urls look like http://example.com/place/info?var=info&morevars=ifneeded Place and info are also variables but they have a fixed name, the ones after would vary. EDIT This is the url I am trying to rewrite http://example.com/test.php?place=test&action=info&var=info&morevars=ifneeded This is wha...

Can't Add Slash with .htaccess

I have a site with some html files on it. One of them is contact.html. This is my .htaccess, and I'm having problems where I can address the page with site.com/contact, but not site.com/contact/. (Note ending slash.) What's the fix? RewriteEngine On # If the requested URI does not contain a period in the final path-part RewriteCond %{R...

how to use mod rewrite

I have transferred my website from old server to shared server. All my code is in "lfdata/main/com" under "public_html" on the shared server. The clean URL would look like follows: http://ip-address/~name/how and the rewritten URL should be: http://ip-address/~name/lfdata/main/com/how.php So can anyone suggest a rewrite rule for cr...

.htaccess/mod_rewrite

Hi, My code is in lf/main/com folder. I have displayed categories on my index page. Ex. childcare, housecleaning.. I need if I click on childcare the clear URL will be childcare.example.com or childcare.ipaddress/~name/ The actually/processed URL will be http://ipaddress/~name/search.php?cat=childcare Thanks, S ...

How to get mod-rewrites and php 301 redirects?

I was hoping someone could also guide me on setting a redirect on a php site pcs4cheap.ca ....I tried to do mod re-writes through the .htaccess, works fine but prevents any othe login or admin page to open ! Any other way I could achieve this would be much appreciated =) ...

.htaccess/mod_rewrite

Hi, Actually I want to run ~name/how instead of ~name/how.php. I have made following changes in .htaccess: # If the requested URI does not contain a period in the final path-part RewriteCond %{REQUEST_URI} !(.[^./]+)$ # and if it does not exist as a directory RewriteCond %{REQUEST_fileNAME} !-d # and if it does not exist as a file Rew...

Absolute and Relative problem in .htaccess (mod_rewrite)

Hi I am new to .htaccess and mod_rewrite. I am using the following Rewrite rules : RewriteRule ^wants/([0-9]+)$ /wantlist.php?wantid=$1 RewriteRule ^dashboard$ /dashboard.php I am able to successfully redirect both the cases. But in order to do this, I had to change the css, js and other paths to absolute paths without which the ...

How is WordPress' .htaccess and SEO built?

I have thought about using WordPress – or maybe just copy a few functions to a internal site – but before I'd use it I would like to know how it's working. I'm thinking that WP is a bunch of slamcode so I'm hoping some of you could help me on how it's built. How is the .htaccess and URL rewrite combined with index.php? - The .htaccess ...

Using mod rewrite to change URL with username variable

How do I change the following client-side URL domain.com/profile/jung domain.com/jung (preferable) to a server-side URL of domain.com/profile.php?user_id=100 with the username in a php variable? I know I need to edit my htaccess file with a RewriteCond and RewriteRule but it's still not clear to me... How does Twitter manage thei...

How do I rewrite URLs that have GET variables in them?

I have a site that makes use of GET variables to determine what to display. @session_start(); @extract($_GET); @extract($_POST); . . . if (!$menu) { include("home.php"); } if ($menu=='buy') { include("buy.php"); } if ($menu=='invalidbuy') { include("invalidbuy.php"); } if ($menu=='buydone') { include("buydone.php"); } . . . I think I ...