mod-rewrite

hide ID mod_rewrite

is there a way to hide IDs using only .htaccess and without changing my php code? htt://www.domain.com/show.php?categoryID=2&cname=electronic&productid=21&name=laptops to htt://www.domain.com/electronics/laptops thanks in advance. ...

url-rewriting and rss feed (feedburner) issue

Hi I am using below rule to read the URL like URL: http://www.example.com/blog/sampe-post-title/10004/ RULE: RewriteRule (.*)/(.*)/([0-9]+)/$ $1/details.asp?mod_id=$3 [NS,I] Everything was fine untill I discovered that links coming via feedburner are not working anymore. Because feedburner adds some extra parameter to URL for stat...

How would this RewriteRule look?

How would I rewrite: character.php?name=Agame to: character/Agame ...

optimizing Pretty URLs in .htaccess

This is the code I use, <IfModule mod_rewrite.c> RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^([^/]+)/?([^/]+) index.php?user=$1&do=$2 [L] </IfModule> if i give it abcd/1234 it will capture abcd first then 1234 as the second variable. But if the url was abcd/ or abcd the first capture stays th...

Amazon EC2 php/fedora htaccess mod_rewrite not working

Amazon EC2 with Fedora, there are 2 instances of the httpd conf, the doc root is automatically set as /home/webuser/helloworld/conf/httpd.conf and the default (which is also there) is /etc/httpd/conf/httpd.conf . Mod rewrite is enabled with both, we are in drupal, the .htaccess is in the folder it needs to be (on Drupal) and it loads t...

with and without trailing slash

What would I make this rule so that you can access it with and without trailing slash? RewriteRule ^members/([^/]+)$ members.php?id=$1 [L] ...

Logical AND in htaccess modrewrite ?

This is my htaccess file RewriteBase / RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] RewriteCond %{REQUEST_URI} !^/chat/ RewriteCond %{REQUEST_URI} !^/m/ RewriteCond %{REQUEST_URI} !^/__admin/ RewriteCond %{REQUEST_URI} !^/gzip_headers.php RewriteCond %{REQUEST_URI} !^/phpfreechat/...

Subtle htaccess problem. I am going insane.

I want to have my primary domain be hosted from a subdirectory (have completed this step somewhat), i.e. when someone types in www.example.com/news behind the scenes it will go to www.example.com/subdirectory/news but will still show up as www.example.com/news. I have used the following bluehost code to accomplish this: RewriteEngine o...

Dealing with non-hardcoded domain names with mod_rewrite

I am migrating my application which provides a subsite for each user from domain.com/~user to user.domain.com. In order to do this, I wrote the following RewriteRule: RewriteRule ^~([a-z_]+)(/.*)?$ http://$1.%{HTTP_HOST}$2 [R=301,QSA,NC] However, %{HTTP_HOST} doesn't do exactly what I need it to, because if for instance a user browses...

[Apache] RewriteRule removing trailing dot.

Hi, here is my .htaccess rules: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(.*)/(.*)$ index.php?var1=$1&item=$2&var2=%{REQUEST_URI} [NC,L] RewriteRule ^(.*)$ index.php?var1=$1 [NC] here is an url: http://loc...

Domain name in URL as variable

Hello! My .htaccess file has the following code: RewriteEngine on RewriteRule ^/?(.*)$ index.php?domain=$1 [L] I'm trying to get domain names as variables from URLs like: hxxp://www.example.com/www.domain.name or hxxp://www.example.com/subdomain.domain.name or hxxp://www.example.com/domain.name but with $_GET['domain'] my variabl...

htaccess url RewriteRule

Hello, This is my url http://mydomain.com/Anonymous/47/comments.php My file hosting script contains lots of rewrites, So how can I redirect this particular type of url to comments.php without conflicting with other rewrites. My htaccess file Options +FollowSymLinks RewriteEngine on ##point to installation directory ##if it is ...

Activate site maintenance via RewriteCond -f check?

I thought about hitting a file via -f (i think it is) in a mod_rewrite RewriteCond, if the file exists, rewrite to maintenance page. I don't think the performance penalty should be too big, but maybe people had other experiences or objections on this idea? ...

With mod_rewrite can I specify a RewriteBase within a RewriteCond?

I'd like to have my .htaccess file specify a different RewriteBase depending on whether the .htaccess file is on my local machine or on a web server. This is the mod_rewrite code I tried, however, it did not work: RewriteCond %{HTTP_HOST} ^localhost:8080 RewriteBase /example/ RewriteCond %{HTTP_HOST} ^www.example.com RewriteBase / Th...

mod_rewrite friendly url

I have been trying to add a mod_rewrite to a site but its only barely working. This URL, "http://domain.com/folder/server/subfolder/index.php" should be rewritten to "http://domain.com/folder/subfolder/index.php?platform=server" This is the last version i'v tried so far. RewriteEngine On RewriteCond %{REQUEST_URI} !(css|images|scripts...

mod_rewrite error

Hi folks, Using this rewrite rule is giving me a 500. What is wrong with my syntax? Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^microsites/(.*)$ /microsites/index.php?uID=$1 [L] What I want to do is silently write http://site.com/microsites/anythingatall to http://site.com/microsites/index.php?uID=anythinga...

Redirect folder link to xml file

So I recently switched away from wordpress. Wordpress keeps all of it's feed URLs at /feed/. This seems reasonable to me, so I never signed up for a site like feedburner. Now I'm using an entirely new blog software, and it puts the feed at /atom.xml. How can I use the .htaccess file to redirect requests to /feed/ to /atom.xml? Or maybe...

Is it possible to obtain the domain where my Flash app is embedded?

The company I work for has their own Flash based video player and the question I get from our execs is "Can we tell what website our player is embedded on?" At first, I hypothesized I could use Apache mod_rewrite, extract the HTTP_REFFER, and append it to the end of the requested URL. So as the browser gets http://.../viewer.swf, I coul...

mod_rewrite on domain root

I am trying to find the correct mod_rewrite code for the following case: domain.de => www.domain.com/de/ domain.de/... => www.domain.com/... www.domain.de => www.domain.com/de/ www.domain.de/... => www.domain.com/... domain.com => www.domain.com/en/ domain.com/... => www.domain.com/... www.domain.com => www.domain.com/en/ www.domain.co...

Mod_rewrite: How do I omit subdomains from rules?

Complete Apache newbie here. I'm trying to get my main URL to redirect to the www. Here's the code I'm using: RewriteCond %{HTTP_HOST} !^www\.domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L] The problem is, this has wrecked my subdomains. sub.domain.com goes to www.sub.domain.com, which doesn't work. So what d...