.htaccess

How to remove part of a URL using .htaccess

Hi, I have a url like this. /domains/details.php (NOTE: domains is dynamic and can be anything) How do I remove the domains part from the URL using .htaccess so the actual lookup is: /details.php OR it'll be cool if I can get domains into the URL. /details.php?page=domains Thanks! Scott ...

mod_rewrite redirects screw up paths

Here's a redirect I have: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1 The problem is if I type http://www.example.com/apple it's OK when it comes to my links on the page. BUT if I use http://www.example.com/apple/ (notice last slash) then links are all scre...

Mod Rewrite - htaccess

Menu code: <a href="/category/<?=$cat_name['id']?>/<?=simpleURI($cat_name['catname'])?>/" title="<?=ucfirst($cat_name['catname']); ?>">Level 1</a> <a href="/category/<?=$subcat_name['id']?>/<?=simpleURI($cat_name['catname'])?>/<?=simpleURI($subcat_name['catname'])?>/" title="<?=ucfirst($subcat_name['catname']); ?>">Level 2</a> <a href...

Pass parameter to wordpress plugin with pretty url, mod_rewrite, .htaccess

Hi, I told wordpress that I wanted urls to look like: domain.com/postname.html I want to pass a parameter to a wordpress plugin. So when I get domain.com/postname.html.2 it is suppose to be domain.com/postname.html?tubepress_page=2 With the following the parameter is passed correctly, but not the name. This is the .htaccess file: <I...

Help with 301 redirects on outgoing links from my site

I work for company that links out to partners through a third party website that tracks them. So for example on our site there will be an outgoing link something like this (names changed to protect my work): <a href="link.php?link=chuckecheese">check it out kids!</a> if you go into link.php, you see I define the link there: $outlink...

Regex to match a URL pattern for a htaccess file

I'm really struggling with this regex. We're launching a new version of our "groups" feature, but need to support all the old groups at the same URL. Luckily, these two features have different url patterns, so this should be easy? Right? Old: domain.com/group/$groupname New: domain.com/group/$groupid/$groupname The current regex ...

How to use htaccess for dynamic generated URLs

Hi, I see sites that use this convention. hxxp://www.twitter.com/golem hxxp://www.twitter.com/golem/following I am trying to do that on my site. "golem" is dynamic and is basically the username. So hxxp://www.mysite.com/golem would go to the golem page. And hxxp://www.mysite.com/golem/details.php would go to the details page for gol...

.htaccess mod_rewrite redirection between domains

I have two domains, cshen.ca and cshen.net, both point to the same place. I'm trying to accomplish the following with mod_rewrite: cshen.net is 301 redirected to cshen.ca www.cshen.net or www.cshen.ca are both redirected to cshen.ca the path after the domain is preserved after being redirected, for example www.cshen.net/foo/bar/ would...

Help with htaccess redirect rewrite rule

I want to use Helicon ISAPI Rewrite to redirect an old URL to a new URL, but only within a virtual directory named colors: http://www.mydomain.com/colors/default.aspx?id=blue needs to redirect to http://www.newdomain.org/colors/default.aspx?id=blue I am new to this and cannot find an appropriate example, so any help would be appreci...

How to redirect non-www to www URL's using htaccess?

I have a website say http://www.example.com/ in the root of my website, I have added .htaccess file to redirect any request of http://example.com/ to http://www.example.com/ Recently I have created a new section "Videos" so the URL for videos is http://www.example.com/videos/ . In this video folder I have another htaccess file which is ...

mod_rewrite problem

I have this rewrite rule to access profile.php?user=username with mysite.com/username.. Problem with this is that it ignores my css, even if I use the full URL and whats weird is that its the same if i go to the regular url, profile.php?user=username. But If i remove my htaccess file the css works. RewriteEngine on RewriteRule (.*) pro...

Why is Apache's RewriteRule revealing local paths?

I'm trying to use RewriteRules in .htaccess with relative paths, but Apache seems to want to output the physical path instead of the server path whenever I try to output a relative path. Absolute and server-root paths work fine. For example: RewriteEngine On # this works fine, 127.0.0.1/ab redirects to 127.0.0.1/cd RewriteRule ^ab$ /cd...

mod rewrite subdirectory as root

I am needing to rewrite www.domain.com/newsite/ as www.domain.com/, basically I am doing this just in case the new site has some unexpected problem, I can easily roll-back to the original by editing the .htaccess file... ...

Using domain name in htaccess rewrite

I host several sites (name based in apache) and I currently have an htaccess that has an error handler ErrorDocument 404 http://mydomain.com/errorDocs/404.htm is there a way for me to pass the domain name that the error came from I want to do some basic redirection. I need something like this: ErrorDocument 404 http://mydomain.com/...

How to logout when using .htaccess (and .htpasswd) authentication?

Possible Duplicate: HTTP authentication logout via PHP Hi I have a some functionality on my website protected using .htaccess and .htpasswd. When users attempt to access this, they get prompt to enter details. They enter their details and get in and can see stuff etc. All works fine. My question is how do I create a logout f...

How to create a domain alias (mapping)

I am looking to map a xxxxx.com to aaaaa.com. They would be hosted on the same server. I just would xxxxx.com to be an alias for aaaaa.com. So if you want to login at aaaaa.com/login.php you can just as easily do it via xxxxx.com/login.php (having xxxxx.com showing in the address bar). Is this possible and if so how? Thank you very muc...

PHP / Apache how to set session.cookie_domain from outside php.ini

Hi There, I need to restrict cookies to my www subdomain, this works by me adding the line session.cookie_domain = www.example.com in the php.ini file. However I have a number of virtual hosts on my server so I need this domain to be different for each one. After a bit of a web-seach, I have tried using: 'SetEnv session.cookie_domain w...

Accessing $_SERVER['DOCUMENT_ROOT'] value in .htaccess file

I need the path specified in $_SERVER['DOCUMENT_ROOT'] to be accessible in .htaccess file. Is there a way to access it there? I basically need to point to a file kept at the root and need the actual file system path and not the URL path. So instead of using a hard coded value, I'd like to be able to use a variable. Thanks. ...

.htaccess with dynamic php - subfolder problems

Hi, Necessary Knowledge My .htaccess file redirects like this: domain.com/about to domain.com/index.php?page=about RewriteRule ^([^/.]+)/?$ index.php?page=$1 [L] The "page" variable is used in a php include: <?php include_once($_SERVER['DOCUMENT_ROOT']."/contents/".$page.".html"); ?> The "contents" folder simply contains .html...

How to automatically route images, javascript, css to subdomain?

So here's the deal, I am building out a site right now and want to plan for the future, in terms of performance and such. One performance trick that I've been reading about lately talks about placing images, javascript, and css (all static) files on a separate subdomain/s so that the client will experience a faster download experience w...