.htaccess

htaccess: redirect all requests to different domain

How can I redirect all requests (irrespective of what page is being requested) on sub.domain.com to newdomain.com? Currently I have Redirect 301 / http://www.newdomain.com/ When a requests comes in for domain.com/shop/product the redirect goes to newdomain.com/shop/product while it should just go to newdomain.com ...

URL Rewriting not working - rewrite rule in .htaccess

I have enabled the rewrite module in apache . Later i developed the .htaccess file in root . RewriteEngine On RewriteRule ^test.html $ test.php but its not working ? Internal server error occurs. What to do next? ...

Apache DirectorySlash Off - Site breaks

If i set DirectorySlash Off in my .htaccess file and call the directory without the trailing slash i get an 403-Forbidden from my server. If i call it with slash everything works fine. Could anyone explain why? Here are my fully anonymized .htaccess: # GLOBAL CONFIG Options +FollowSymlinks DirectorySlash Off AddDefaultCharset utf-8 php...

.htaccess url rewriting /project/Login to /project/public/index.php/Login without redirecting URL

I have this .htaccess code that works perfectly: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ public/index.php [QSA,L] </IfModule> ...but this code redirects to public sub directory. I don't know if it's possible to rewrite url without redirecting, just use /project/Login appointing to /pr...

Redirect specific page via htaccess

I have a CodeIgniter site and the problem is I have: RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L] But this results in people going from example.com to www.example.com/index.php/ I'd like them simply to go to www.example.com Any ideas? Also, if they're at example.com/page1 they s...

Problem with htaccess file. Wordpress Plugin tells me there is one, I can't find one?

hey guys, i have an really unusual problem i've never had before. i've no .htaccess file on my server. looked everywhere, there is just no file, but a Wordpress Plugin (AskApacheRewriteRules) tells me that the following Rules are active: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond ...

mod_rewrite: rewrite specific URL

Hello. I want to rewrite a specific URL, I'll show an example so you'll understand what I mean. First, my current rewrite rule: RewriteRule ^/?([a-zA-Z0-9/-]+)/?$ /index.php [NC,L] Now I want this URL: http://example.tld/foobar?test Rewritten to: http://example.tld/foobar Note: only for /foobar?test! E.g. not for /somethingelse?t...

Rewrite base rule- php

Internal URL: example.com/abc/xyz/rule.php?price=1&pass=2 External URL: example.com/abc/xyz/rule/1/2 But the css, js files are not coming into effect in the external URL. My .htaccess file: RewriteEngine On RewriteBase /example.com/abc/ RewriteRule ^rule/([0-9]+)/([0-9]+)/?$ rule.php?price=$1&pass=$2 ...

rewritebase not working

Hi , I am using the rewrite url , And its working fine , But if do url rewriting then my CSS and JS not working bcoz i am call my script / css somthing like href='css/style.css' , I tried direct url instead of siteurl , Then css working , i finally desired ed to use rewritebase but for me its not working , if put this snippet then t...

Accessing the images folder of Joomla directly

I want to be able to access some images I have on my Joomla site from another site. e.g. I want to be able to type <img src="http://www.myjoomladomain/images/imag.jpg"&gt; in a html file on another different site and view the image. It's been telling me I do not have permission to access the folder. please how can I go about it ...

How can I do this with .htaccess

Hello. I was writing a PHP (Kohana) app and I saw that the controller index pages could be seen with & without /index. http://plugb.com/ & http://plugb.com/index In order to avoid duplicated content, I did this: $clean_url = str_replace('index','',$this->request->uri); if($clean_url !== $this->request->uri) { $this->request->redire...

htaccess rewrite rule 'page numbers' problem

Hi, I've added a .htaccess file to my root folder for the purposes of rewriting dynamic URLs into static ones. This seems to have been done successfully but I am having problems with page numbers. For example, if you were to visit a static page /widgets, the first page of the products is fine....but subsequent pages show up as /products...

htaccess, a shortened url should not match a file

Hi! I have a little problem with my apache2 and .htaccess rules. for example: I have a shortened uri like www.domain.tld/sitemap which has to be rewritten by a rewriterule, redirected in a php File to display the sitemap. The problem is, that in the root folder a file named sitemap.xml exists. My apache automatically calls the sit...

URL as variable in .htaccess rewrite

I'm writing an API where a URL needs to be passed via $_GET variables. Now that's all cool when I'm just using the raw URL, create_page.php?url=http://example.com, but I've tried to make this look pretty using htdocs like I have the other API calls and it doesn't work. Here's my htaccess code so far. RewriteRule ^create_page/(.*)$ creat...

.htaccess is interfering with nested .htaccess/.htpasswd?

I'm using Simple Mailing List (http://www.notonebit.com/projects/mailing-list). It's good mailing list, but no admin area. So you have to use .htaccess/.htpasswd to protect the /mail/admin folder. However, my site has WordPress installed in the website's root folder. WordPress creates .htaccess for custom permalinks. And for some reason...

Dynamically creating URLs for other websites

Hi, I'd like to know how websites have created URLs with other domains like these on trafficestimate.com. I'm guessing it's some .htaccess stuff to redirect domain names to a dynamic page? Thanks ...

map .html to .php only is file exists

Here is my rule: RewriteRule ^(.*)\.html$ /$1.php This works for "virtual" .html urls which have a matching physical .php file on the server. However when I type in a url for an actual .html file, I cannot access it, because of course the rule above is telling the server to look for a physical .php file. So how can the rule be modif...

Pretty Profile URLs without conflicts with pages

Hello, I want to use profile URLs on my site such as xyz.com/username I am using the follow code: RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?p=profile&u=$1 [L,QSA] RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?p=profile&u=$1 [L,QSA] My question is... How can I use it like this, and keep the access to other links such as xyz.com/forums,...

HTAccess Page Redirecting problem with & sign

hi, I am trying to make my pages seo friendly. I have a links in my page. http://abc.com/test.php?Section=pages&amp;title=feedback+%26+enquiry it works fine and title has value "feedback & enquiry". I changed above link to: http://abc.com/pages/feedback+%26+enquiry.htm I wrote the htaccess code like: Options +FollowSymLinks Rew...

Problem with htaccess (images)

RewriteRule ([a-zA-Z0-9/_]+)/([0-9]+)x([0-9]+)_([0-9a-zA-Z_]+).([0-9a-zA-Z_]+)$ imgsize.php?&w=$2&h=$3img=$1/$4.$5 [L] path to file: /imgsize.php?w=200&h=100&img=uploads/elvita.jpg /uploads/100x110_elvita.jpg why its not working? :( ...