.htaccess

How to use errordocument to redirect to a php file in the same folder?

I want to take requests for missing files in a specific folder and redirect them to program.php in that folder. This is a program I will use a lot in different places, and I would prefer to avoid specifying the name of the folder in the htaccess file. I have tried just putting: errordocument 404 program.php but the result is that the...

How to use rewriterule to redirect to a php file in the same folder?

I would like to take requests for /somefolder/style.css and handle them with /somefolder/program.php So, I put the following in my .htaccess file: rewriteengine on rewriterule ^style.css$ program.php?css=1 [R=302,L] The result is that instead of redirecting to /somefolder/program.php, the server tries to redirect to: /var/www/html...

Accessing URLS by www.example.com/page instead of www.example.com/page.php

What handles the disabling of the extension? Is it APACHE or the PHP install? How would one go about configuring the web server where the .php extension is not required? Is there an option that would make both www.example.com/page.php and www.example.com/page work as the URL? ...

htaccess redirect incoming url to internal page and pass GET variables

I am trying to pass URLs to my site that contain numbers like this: www.example.com/234 I want them to be rewritten like this: www.example.com/view.php?id=234 My rewrite rules that are not working: RewriteEngine on rewritecond %{http_host} ^example.com [nc] rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc] RewriteRule ...

what does this rewrite actually do ?

RewriteCond %{REQUEST_URI} ^/new/ RewriteRule ^(.*)$ new.php?title=$1 [L,QSA] im confused as to what this does.... what does the REQEUST_URI do ? ...

RewriteRule with string starting "http://"

Hi, I'm having problems working out how I can do the following using htaccess: http://isitup.org/http://example.com => http://isitup.org/example.com I think the problem is the second double slashes, but I can't think of a solution. Here's my current (failed) attempt: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME...

Limit access on login and IP in .htaccess

There are many examples showing how to use .htaccess to restrict users by login or on their IP address (i.e they are ok from the ones given without authorisation). For some reason the following is never mentioned, yet it seems quite useful. How do I restrict using groups and ip, e.g. group1 can access the page from anywhere group2 can ...

subdomains pointing subfolders with mod rewrite

Hi I'm quite new to PHP... And need something to do as fast as I can.. I have some clients within the "clients" directory like here... "http://domain.com/clients/client0001/fluids/..." I want this URL to be shown in the address bar like this. "http://client0001.domain.com/fluids/..." with the help of .htaccess. Any help will be appre...

301 Redirect with htaccess and Cache: How to Delete Old Cache?

So after much help and research I've FINALLY been able to get the 301 redirects working via .htaccess file, but I noticed that unless I actually hit 'refresh' on my browser it will not redirect the page due to simply reading the cached site. I've tried closing all browsers, inserting the .htaccess file, and THEN opening a new browser, b...

.htaccess for clean URL not working

I am working with PHP and htacess for the first time. I am passing a variables in a query string to a URL and want this URL to look clean. Please help. .htaccess file RewriteEngine On RewriteRule ^id-([0-9]+)/([0-9A-Za-z]+).html /detail.php?id=$1&display=$2 PHP code passing from one file to detail page URL is: <a href='/detail.ph...

Duplicate content with forwarding from TLD to different 'start page'

I came across something interesting today. See this site. Notice that the TLD automatically forwards to /about-alc/. This is because, the home section is actually called 'About ALC'. I recently used a site map generator, and it said 'Duplicate content' for the TLD and the /about-alc/ Is this not a good approach? Should I just throw a...

How to setup .htaccess redirect for particular category blogs (wordpress)

I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST%5FTITLE%/ Now i want to redirect a particular category blogs to a different domain. The URL Scheme on that other domain is similar. Please suggest me how can i do it using .htaccess ...

URL Aliasing using .htaccess

i'm having 'domainname1/folder/' .In Domainname1 i'm having a subdirectory which is a subdomain (abc.mydomain.com) of other domain. but this is referred to 'domainname1/folder/' . the thing is that i want the URL links accessing from 'domainname1/folder/' should be displayed following with sub domain like . 'domainname1/folder/' to ...

Masking Domain URL with Sub domain URL

Hai i'm having a subdomain (abc.example.in) but this is referred to mydomain/folder . the thing is i want the mask URL links and the masked url should be displayed following with sub domain can any one help me out . mydomain/folder/path to abc.example.in/path ...

.htaccess Redirect non-WWW to WWW preserving URI string

I'm running the CodeIgniter platform, which uses .htaccess to accept URLs like http://www.mysite.com/controller/function/argument I currently use some .htaccess rewrites, namely (simplified): RewriteEngine On RewriteCond %{REQUEST_URI} !^(/index\.php|/images|/assets) RewriteRule ^(.*)$ /index.php/$1 [L] I want to add a rewrite rule...

Performance-oriented way to protect files on PHP level?

I am looking for some input on something I have been thinking about for a long time. It is a very general problem, maybe there are solutions out there I haven't thought of yet. I have a PHP-based CMS. For each page created in the CMS, the user can upload assets (Files to download, Images, etc.) Those assets are stored in a directory, ...

Trouble with advanced .htaccess redirect

I'm migrating a custom coded blog over to Wordpress, and have to set up a redirect that will handle all of the blog posts. I need to redirect from this: /oldblogdirectory/Old_Blog_Posts_Looked_Like_This.htm to: /newblogdirectory/new-blog-posts-look-like-this/ Any ideas on the regex for a redirect like this? ...

Getting .htaccess to work for all directories

I'm having a problem with .htaccess. I've inserted <IfModule mod_php5.c> php_flag include_path ".:/usr/local/lib/php:library/" php_admin_flag safe_mode on </IfModule> inside the public_html folder, and it works for that folder only. When I go into sub-directories of public_html, it ignores that and the 'include_path' is different...

.htaccess not working

RewriteEngine on RewriteCond $1 !^(index\.php|files|assets|robots\.txt) RewriteRule ^(.*)$ ./index.php/$1 [L] The website is hosted on the latest version of XAMPP locally. When I load the website with the .htaccess file in place, it won't load at all. I get a server error What am I doing wrong? EDIT: Checked log file, here's an error...

.htaccess and url

Is it possible somehow using mod_rewrite change the url from http://www.mywebsite.com/company/123/reviews to http://www.mywebsite.com/company-123/reivews? It's not a redirect. The problem is that the real path is the first one and I need my browser to display the second path. So when the user goes to company-123/reviews the content of t...