.htaccess

Apache RewriteRule .* index.php [NC,L] Not working

I am trying to redirect everything to a single page from my /website/folder/ directory. I added a simple .htaccess with this simple code (I know this would require more code in .htaccess but it's just a test). RewriteEngine on RewriteRule .* index.php [NC,L] When I try : http://127.0.0.1:8888/website/folder/fileDoesntExistMustGoInde...

Bad mod_rewrite or .htaccess Practices?

I'm just getting into using mod_rewrite and I want to know from the server gurus what gets under their skin about web developers like me playing around with their apaches. Are there some common developer mistakes and/or bad practices to avoid? ...

Using htaccess rewrite/redirect so single PHP file can display data according to GET/POST variables

Hey gang, Bear with me as I try to learn more about .htaccess redirect rules - I'm a UI guy by profession and I'm doing my best to enhance my coding skills languages other than HTML/CSS/PHP, etc So, what I have is an index.php file that contains a menu - pretty simple. If Javascript is enabled on the users computer then forms are shown...

.htaccess & mod_rewrite for passing GET parameters

...

site not working with url www

hello im having problem with my site when i type http://example.com it works fine but when i type http://www.example.com it displays page cannot be found , what is the problem i couldnot find , i tried .htaccess redirection also RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.com [nc] RewriteRule (.*) example.com/$1 [R=301,L] ...

Converting Mod-rewrite rules which use %(QUERY_STRING) to NGINX rewrite format?

I've been stuck the last few days trying to convert the following Apache/Mod_Rewrite rewrite rule to NGINX format. Anyone know where I am going wrong? MOD_REWRITE: RewriteCond %{QUERY_STRING} topic=([0-9]+) RewriteRule /forum/index\.php /forum/vbseo301.php?action=thread&oldid=%1 [L] NGINX: location /forum/index.php { if (...

.htaccess url rewrite with ssl redirection

I'm having trouble combining a url query parameter rewrite (fancy-url) with a .htaccess ssl redirection. My .htaccess file is currently: Options +FollowSymLinks Options -Indexes ServerSignature Off RewriteEngine on RewriteBase / # in https: process secure.html in https RewriteCond %{server_port} =443 RewriteCond $1 ^secure$ [NC] Rewri...

mod_rewrite to find missing /img/foo.jpg in /img/f/

I've got a folder of images which is reaching a critical mass after a few years. I want to move images into alphabetical folders, so that /img/foo.jpg goes into /img/f/foo.jpg and /img/bar.jpg goes into /img/b/bar.jpg and so on. In order to make the transition smooth, and to allow the manual uploaders to put stuff into the top level, I...

Mod rewrite for fake subdomains?

Hello, I really tried tons of methods but i'm not successful. I want a .Htaccess code to do the following : I want to rename this : http://www.mydomain.com/media --> http://media.mydomain.com So, By example instead of calling this : http://www.mydomain.com/media/XXX/picture.jpg i will call : http://media.mydomain.com/XXX/picture.jpg ...

Does mod_rewrite in subdirectories' .htaccess override higher levels?

I'm using mod_rewrite to map my old directory structure to a new one. I have the following rule in my top-level .htaccess file, and it works: RewriteEngine On RewriteCond %{REQUEST_URI} /blog/archives/(.*) RewriteRule ^.*$ /archives/%1 [L,R=301] As you can guess, this takes http://example.com/blog/archives/00001.php and redirects it t...

.htaccess, two consecutive rewrites?

I need to take a url, "/ServiceSearch/r.php?n=blahblah", and have it go to "/search/blahblah/" so that it appears in the browser as "/search/blahblah", but I actually want it to REALLY be going to "r.php?n=ServiceSearch&n=blahblah".. So I was thinking I'll need to rewrite the first URL to "/ServiceSearch/r.php?n=blahblah" and then the ...

Wildcard DNS with URI Request

So here is my problem. I want to redirect name.domain.com/trips/1 to domain.com?username=name&trip=1 using modrewrite. Is this possible? I have the dns set up correctly however - I am unsure about the htaccess file. Can I link all this information to one PHP or do I need to create a directory for every user? Thanks for your help. ...

Redirect to a specific url depending upon the base url using htaccess file

I am using htaccess to redirect to url with page description. For example RewriteRule ^Flash$ /index.php?section=flash [L,NC] By using this code when i hot domain.com/Flash it redirects me to www.domain.com/index.php? section=flash. This works fine. But now what i want to have two more site with the same htaccess file. So can an...

.htaccess 301 redirect without GET var

Hi, For a website I'm currently working on we're redirecting our old URL's permanently to new ones like this: Redirect 301 /oldfile.php http://www.site.com/show/newurl Now I come across this situation in which the old url has a get var like: Redirect 301 /oldfile.php?var=name http://www.site.com/show/newurl This will redirect the oldf...

Rewriting a number based URL using .htaccess RewriteRule

How can I rewrite a simple number based URL to a sub folder? I want http://mysite.com/123 to redirect to http://mysite.com/en/123. The number could be anything from 1 - 9999. My attempt in htaccess was: RewriteRule ^([0-9]+)$ /en/$1/ [R] But that doesn't work. ...

Mod redirct error.

when I used the SSL fot my website i got following error. in error log. and site shows me default page instead of actual page. I got following error. .htaccess: RewriteEngine not allowed here ...

Rewrite URL in PHP with mod_rewrite

The web server is Apache. I want to rewrite URL so a user won't know the actual directory. For example: The original URL: www.mydomainname.com/en/piecework/piecework.php?piecework_id=11 Expected URL: piecework.mydomainname.com/en/11 How to achieve it with mod_rewrite? ...

.htaccess for hiding url details

Options +FollowSymlinks RewriteEngine on RewriteRule ^WR-(.*)\.html$ WR.php?act=show i have created .htaccess file to rewrite WR.php?act=show to .html extension and save this file in a folder where my source file are residing. but it is not working can anybody help me please.... ...

Apache .htaccess: ErrorDocument and RewriteEngine not working together

Please take a look at the following .htaccess ErrorDocument 404 /404/ RewriteEngine On RewriteRule (.*) index.php [L] With this setup, I am using header('HTTP/1.1 404 Not Found'); in PHP to redirect to the error handling page and send the appropriate HTTP status code. The correct 404 status code is sent, but the browser shows a blank...

Possible htaccess solution for a subdomain pointing to a module

Hey there, I've been using the Zend Framework to map subdomain requests to a module in my main MVC application but now I need to change the virtual host config back and use a htaccess file instead. Previously all I needed to do in the virtual host config was to set the subdomain DocumentRoot to be the document root of the main applicati...