.htaccess

How do I redirect all but one url to a script

I'm trying to get www.example.com and www.example.com/index.html to go to index.html, but I want all other urls e.g. www.example.com/this/is/another/link to still show www.example.com/this/is/another/link but be processed by a generic script. I've tried RewriteEngine on RewriteCond %{REQUEST_URI} !^index\.html$ RewriteCond %{REQUEST_UR...

Is there a way to do some sort of regex loop in .htaccess

hi at the minute I have a list of rules in my .htaccess file but if I need to add a new page i then need to edit this file again and add yet another rulles. HEre is a few RewriteRule ^admin/(.*).html$ index.php?x=admin&y=$1 RewriteRule ^admin/project/(.*).html$ index.php?x=work&p=project&$1 RewriteRule ^work/(.*).html$ index.php?x=work&...

htaccess trick to load resources (js/css) below the web root

I am trying to achieve something that I am not sure if htaccess can even do. What I have is a folder structure: myapp some_folder some.js www css js now the web root is pointing at www folder so i can do http://mydomain.com/js/jquery.js and it would work but what I want to do is http://mydomain.com/myapp/some_folder/some.js a...

Permalink for external links

I would like to use permalink for external links on my site. For example, if I have this link on my site: google.com, it should rewrite to [and show the reader]: mysite.com/go/google Is this possible? Any ideas on how to go about doing this in .htaccess? ...

Redirect old Wordpress Posts to new URL

I am assuming I have to use .htaccess, but what do i do to tell my oldsite http://oldsite.com/post-slug to redirect any "post-slug" to http://newsite.com/post-slug automatically. ...

how to use exec() to update, delete and edit username and password of .htpasswd?

Dear all exec() is new to me and i am trying to learn on how to use it to edit and update usernames and passwords of visitors, if there is a tutorial website or someone can teach me on how to use it ...

Redirect root of parked domain in one way, all other urls in another way, using htaccess

I recently got an alternate domain (parked) and would like it to behave like this: on a request for "alt-domain.com/" (root): serve "main-domain.com/fakeroot" without a redirect (200) on a request for "alt-domain.com/anyotherpage": serve "main-domain.com/anyotherpage" with a redirect (301) I tried this, but it doesn't work: RewriteC...

.htaccess rules being ignored?

I know I can do a redirect using a PHP header in a directory but I want to do it in a tidier fashion with the use of .htaccess. I've looked at all the answers and other examples but they seem to be ignored? I am using the .htaccess file placed in the root of the site directory. I want subdomain.domain.com/directorya to redirect to sub...

rewrite url using htaccess

How can I change url in this way using htaccess: http://example.com/page.php?go=something.php should be redirected to: http://example.com/something If the get parameter name is different than 'go' leave as it is... ...

.htaccess subdomain to folder

Hey all, I've recently made some minor changes to my website's folder structure, and now one of my rewriterules seems broken. in the past I had a /mydomain.com/ folder in public_html in which a wiki was set up. In the same folder were some folders that I used for subdomain access, like members and files. The old setup: #www to main w...

Zend and modrewrite not working together properly

I'm setting up a Zend application, and went through the basic steps of setting up modrewrite on my development station, and writing an .htaccess file (shown below). Now, when I go to the root of my project, Zend works properly, calling the controller and displaying the appropriate page. However, when I call any controller, I would expec...

htaccess redirect for existence of a specific URL variable

Hello all, I've been reading hard for a good few hours and still can't find what I need! Hopefully someone here can help. What I want to achieve is to redirect a specific URL with a specific variable to another page, but not when there are other URL variables present. eg. index.php?option=com_user - this needs to be redirected to i...

Trying to use .htaccess rules to redirect to load FR content w/ a FR domain and EN content w/ an EN Domain

I'm using MediaWiki with mulitlingual subpages. When I go to "english.com/Page_title" I want to load just that (which is the default) When I go to "french.com/Page_title" I want to load the /fr subpage, which is "french.com/Page_title/fr" and here's my current rules: RewriteBase / RewriteRule ^[^:]*\.(php|src|jpg|jpeg|png|gif|css|js...

RewriteCond not stopping at end.. /example will work... but example/anotherlink doesnt

Hi.. this might be a no brainer to some, but I am trying to specify some RewriteCond in an .htaccess file and I am failing badly. Heres what I have : RewriteCond %{REQUEST_FILENAME} employee [NC] RewriteRule ^(.*)$ /resources/employee [L,R=301] will redirect fine... but if I include any other rules that include 'employee' like th...

How to alter the url of a directory

I need to change the url of a directory so that: www.example.com/foo/ becomes www.example.com I can't move the files. Putting a htaccess file using mod_rewrite to simply rewrite www.example.com to www.example.com/foo wasn't a problem RewriteEngine On RewriteRule !^foo/ foo%{REQUEST_URI} [L] However I must ensure that if the use...

htaccess infinite redirect

I'm working on a legacy codebase, with three different folders of images. An image could be in any one of the three folders, in a pretty much random manner. I initially attempted to check for file existence within PHP; however, images are being displayed in tons of places, and I'm hoping I can just achieve the same thing with an htacces...

GET Variables Show Up in URL on .htaccess Rewrite of URLs That Don't Terminate with /

I'm having an issue with my rewrites exposing GET variables if the originating request isn't terminated with a forward slash (/). Here's my rule: # All requests are routed to PHP RewriteRule ^(.*)$ framework/index.php?framework=$1&%{QUERY_STRING} [L] If I visit: http://www.domain.com/folder/ everything works great. If I visit: htt...

URL rewriting using .htaccess

I have my link like this /product.php?id=1 I want to rewrite that in .htaccess like /productname/id or /productname/1. Can you help me guys, I’m using PHP? ...

apache/htaccess url rewriting help .

Okay what i want to do is ... http://domain.com/hdu79ejo above should be redirected to http://domain.com/client/?share=hdu79ejo where hdu79ejo can be any value. But ... http://domain.com/client and http://domain.com should not be redirected at all. Here is my code RewriteEngine on RewriteCond $1 !^(client) RewriteRule ...

Controlling Login Validation Error Message Direction

I'm working on a website for the marching band that I'm part of, and there is a "Member's Only" page that requires a password. When you click the link for the page, you're prompted for a username and password. If you enter an incorrect user/pass and click OK you are correctly directed to a generic error page. However, if you click Cance...