.htaccess

Why am I getting an "unexpected T_STRING error"

I'm trying to get Zend Amf working on my hosting services (Lunarpages, if that matters). I can get it working on my local machine, but after changing a few directories and posting the code, I keep getting this error: Parse error: syntax error, unexpected T_STRING, expecting '{' in /home/user_name/public_html/library/Zend/Amf/Server.php...

Completely stumped with .htaccess

Hi All, I'm trying to write what I thought was a pretty simple rule but either I'm missing something painfully obvious or it isn't such a simple rule. In fact two others have looked at it and no one can seem to tell what I'm doing wrong. I just moved a site to a new platform and need to set up some 301 redirects from dynamic pages to s...

How can I use mod_rewrite to 301 redirect example.com to www.example.com?

I need to redirect any URLs without "www." to URLs with "www." for better search engine optimization. I read that this is possible with mod_rewrite and .htaccess files, but I do not know the right code to use. Can anyone help? ...

.htaccess conditional rewrite

Hi guys, I'm trying to create an conditional Rewrite Rule using an .htaccess file and Apache. Basically what I need is that the Apache would check if the requested file exists in a sub folder, case in which Apache would serve this existing file, or, if the file does not exist, Apache would load the index.php file. The folder structure...

Mod Rewrite Easy problem with Cookies

I'm trying to catch all the non-logged-in users who are trying to get to a directory (where my .htaccess is placed). If someone is not logged-in and try to access some page in this directory, it will be redirected to page "user/?login=222" A user is logged-in, when the Cookie "HDV-UL" starts with a 5 digit number. This is my .htaccess: ...

Apache htaccess re-write URL rules?

I want to create URL re-write rules for following URL in htaccess. http://example.com/vedios/category/fun/ -> http://example.com/vedios/category.php?cat=fun http://example.com/vedios/category/fun/?show=popular -> http://example.com/vedios/category.php?cat=comedy&show=popular http://example.com/vedios/category/fun/?show=popular&amp...

404 Error: Mod_Rewrite not working

I managed to get some help from a previous question and I have the following in my .htaccess in my web root. # REWRITE DEFAULTS RewriteEngine On RewriteBase / # /view.php?t=h5k6 externally to /h5k6 RewriteCond %{THE_REQUEST} ^GET\ /view\.php RewriteCond %{QUERY_STRING} ^([^&]*&)*t=([^&]+)&?.*$ RewriteRule ^/view\.php$ /%2 [L,R=301] # ...

How to programatically access a password protected website?

Part of our website is protected with .htaccess style password protection. When you try to access this area of the website the web browser pops up a dialog asking for your username and password. I need to access this programatically (eg with an ajax call). How does the server tell me it needs a password and how do I supply it? ...

How to support "AddType x-mapp-php5 .php" on my development machine

My ISP requires me to put the following in my .htaccess files: AddType x-mapp-php5 .php But that breaks my development machine. I don't really understand what that directive is for, but I'm sick of commenting it out for dev, and uncommenting it whenever I need to upload a new version. Is there some way of supporting it in dev? ...

Which one is faster rewrite or folder based URLs?

I am creating URLs in my website as http://example.com/register/ http://example.com/login/ I am creating above URLS by writing following rules in htaccess RewriteRule register/ /register.php RewriteRule login/ /login.php Now its working fine for me, but if I create my URLs by creating seprate folder for /login/index.php and /reg...

Entering .htaccess-protected directory using a form

A password-protected area of a website I work on has always been entered by linking to the address, which presents the user with a dialog to enter their username and password. I would like to use a form to enter that information, but I can't work out how it's done and whether it's possible. Help please! Edit: Does anyone have any ideas...

Can't get URL to resolve...htaccess, mod_rewrite, wordpress issue

I'm having an issue with a rewrite. I have a Wordpress install in my /blog directory, but I want the Wordpress Pages to appear outside of the blog directory. So, in my root .htaccess I added a line: (The first three lines were already there for redirecting everything to "www" RewriteEngine on RewriteCond %{HTTP_HOST} ^tooboss.com$ Re...

How to stop direct execution of a php page using htaccess rules?

In my .htaccess file I have defined the following rule to make my register page URL as http://example.com/register/ RewriteRule register/ /register.php The above rule is perfectly fine but I can access my register page from http://example.com/register/ as well as from http://example.com/register.php. I don't want that user will be ...

htaccess rule to forward /login/ and /login to same page?

I have the following rule in my current .htaccess file to redirect /videos/login/ requests to /videos/login.php RewriteRule login/ /videos/login.php This works fine if I am access login page using http://mysite.com/videos/login/ but when I am trying to access the same page using http://mysite.com/videos/login (without ending slash) th...

Correctly switching between HTTP and HTTPS using .htaccess

We've got a shopping site which we're hosting on a shared host (Mediatemple Gridserver). Some parts of the site need to use HTTPS (checkout etc) but the rest should be using HTTP. Does anyone know how we can always force the correct use of HTTP/HTTPS for particular URLs? We've had it working in various states but we can't get a request ...

right order of rewrite rules in an htaccess file.

hi ! I need to have : http://www.example.com/v1/my-project/ redirected to http://example.com/my-project/ so : (1) remove the www from the http_host RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] (2) remove the 'v1/' part of the request_uri RewriteCond %{REQUEST_URI} ^/v1/(...

Why this RewriteRule doesn't work?

Hello to everybody! I'm developing a web site containing 3 pages (Home, page2, page3) ... in the second page there is a navigation bar, with 4 items (subpage1, subpage2, ...), that I use to replace the content of the page 2 with url variables! In other words, the second item of the navigation bar in page2 points to: http://localhost/uk/...

.htaccess rewrite of a url [help with rule]

Hiya, I'm trying to rewrite a url of this: http://www.foo.com/bar/baz to index.php?q=$1&d=baz Where bar is not a fixed value, but baz is. RewriteRule ^(.*)\/baz$ index.php?q=$1&d=baz [L,QSA] RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] What i have above kinda works but unfortunately breaks all the includes in the site (css/javas...

Problem enabling .htaccess

I'm trying to enable .htaccess files on a Ubuntu server I set up. I changed the sites file from: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www> Options Indexes FollowSymLinks MultiViews ...

Helicon Redirect to IIS6 Virtual Directory - .htaccess Syntax and location

I'm moving my blog which was in a physical folder (/blog/) on my IIS 6 web server to a virtual directory called the same name (blog) running BlogEngine.net, the virtual directory is running in the same application pool as the parent website. I want to redirect each .html post to the new BlogEngine.net URL. e.g. http://www.mywebsite...