.htaccess

Having trouble with a simple .htaccess redirect

I've been working on this for a while and have tried a lot of different solutions I've seen on the web and can't seem to get this to work. I have a site at www.mydomainname.com. The page that I want to handle ALL page requests is www.mydomain.com/index.php. I'd also like to set this up to work for any other domains that I point to this ...

htaccess rewritecond

Hi, We have a domain name with various TLDs. Let's use example.com as our main URL, and we redirect example.biz, example.net, example.org to example.com. We had the following in .htaccess file and it worked very well: RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] You notice...

properly structuring an htaccess with multiple rules/conds

How would i properly structure this htaccess file as to correctly function in order and avoid infinite loops? RewriteEngine on RewriteCond %{HTTP_HOST} !^www.domain.com$ RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301] RewriteBase / RewriteRule ^deviceToken/$ devicetoken.php [QSA,L] RewriteRule ^register/$ register.php [QSA,L] Rewri...

.htaccess - help with a rewrite rule for ssl

So I've got a website and an SSL certificate. Everything is set up and working, however, both http://example.com/checkout and https://example.com/checkout work. I'm hoping there's a way to write a rule where anything going to /checkout is rerouted to https. Ideas? ...

On site load: "Cannot read .htaccess"

Hi, I'm trying to get my website back online after recovering from an XSS attack. At the time of the attack, I set all the file permissions to 400 to take the site offline. I left it that way for a few days, and then ended up deleting all the files in the var/www/ directory and uploading a full backup of the site. The backup had screw...

HTACCESS Redirects

In my htaccess file, I have the following two rules. I would like to make the second one occur on the condition that the first one doesn't match. Currently, they both get run. Is there any way around the collision? redirect 301 /lorem/ipsum-keyword.html /lorem/dolorem-keyword.html RewriteRule (.*)-keyword.html$ /dir/file.php?param=$1 ...

Save HTTP_REFERER with mod_rewrite?

Hi everybody, actually I'm trying to pass referers inside the .htaccess. What I'm trying to do is that the referer value shall be send to a PHP script where this value will be saved to a databse. In some cases (depending on the referer) the image shall be blocked (hot linking) and in some other cases the image shall be shown normally. B...

mod_rewrite and php variables

I am trying to get mod_rewrite to work with my site but for some reason it's not working. I've already entered code into my .htaccess file to redirect non-www to www so I know mod_rewrite is working in general. The url's I'm trying to change are example.com/index.php?p=home so the new URL would be example.com/page/home However, when I ...

Generic htaccess URL rewriting

Even simple .htaccess gives me headaches and I need to do the following generic mapping: http://example.com/project/controllername/key1/val1/key2/val2/.../keyN/valN --> http://example.com/project/controllername.xyz?key1=val1&key2=val2...&keyN=valN example: http://example.com/so/pagecontroller/id/1/time/12345/title/helloworl...

Expression engine multi-lingaul site on one install

Hi There, I am currently working with expression engine, and we are wanting to create a multilingual site, using just one instance of expressionengine, without having to pay for the multi-site license. For this reason I have a couple of questions? I know it is possible to set up the system so we can a domain structure of something ...

need to escape # (hash/pound) character in .htaccess rewrite rule

The question is fairly simple but I was not able to find an answer for hours now. What I need to do is: RewriteRule ([^#])#(.*) $1\%23$2 Which basically means I want to url escape the freaking hash sign which comes to me from an external codepiece. backslash (\) does not work to escape this sign... and please don't suggest using %23...

Create my own tinyurl using htaccess rewrite

I would like to create a mod rewrite in my htaccess file that will can change this: mydomain.com/abCdE to this: mydomain.com/controller/view/parameter/abCdE Thanks in advance! P.S. I'm using Zend Framework Stefano ...

re written url causing duplicate pages

I have tried to rewrite my url so that it removes php extention and adds trailing slash. I can access the page this way now.. lovelakedistrict.com/lake-district-cottages/ but i can also access it via this way: lovelakedistrict.com/lake-district-cottages.php how can I remove the php extention for good. this my htaccess Options +Follo...

How to make all HTTP requests go through HTTPS using .htaccess or PHP

Hello, Ok here's my issue I have a file that is delivered through https, all the files on my server have a common header.php file that is included within files. In the header file i have all my stylesheets etc called from my cdn folder. http://cdn.domain.com since they are called http in my https file (via header.php) it doesnt transmit ...

PHP & .htaccess working together

Any help on this would be greatly appreciated: I have a website running with php on IIS6 IIS7. I am protecting all the .php files by starting a session. The .php pages can only be accessed if the session is started by logging in through the login.php page All my .php files are in the following directory (using as example): home/dir ...

.htaccess redirect conflicts with another htaccess rule that I can not remove

The Information: So I am fairly new to .htaccess and have being reading a bit. Basically I want to do this, redirect the url www.example.com/center-pro to www.example.com/pro-hq (found how here here http://stackoverflow.com/questions/3374696/htaccess-url-redirect) However the site i am work on already has a .htaccess file in place. ...

change domain.com/folder/stuff to domain.com/stuff using mod_rewrite

I would like to 301 redirect domain.com/folder/blah_blah to domain.com/blah_blah How can I do this using mod_rewrite? ...

ajax file not loading because of trailing slash

I have an ajax file that is called when someone begins to type in search bar. I have recently been cleaning up my urls and removing file extentions adding trailing slashes, since then my ajax file doesnt appear to load anymore. can anyone help? here my htaccess so far Options +FollowSymlinks Options +Indexes RewriteEngine on RewriteCo...

Very basic rewrite-rule question

I have this url: http://www.mydomain.com/index.html And want a rule to rewrite the above into this: http://www.mydomain.com In other words, remove the index.html part of the code... Something like this maybe: RewriteRule ^$ index.html [NC] Thanks UPDATE: When you type www.domain.com into the browser, offcourse index.html ...

Do You Have to Escape a Forward Slash When Using Mod_Rewrite

I am very sorry if this question has been asked before, I have searched but I am still quite unsure. With regards to the forward slash "/" when giving a RegEx to RewriteRule or RewriteCond, or anything else related to .htaccess in particular, is there a need to escape the forward slash? Here is an example of what I am trying to achieve...