mod-rewrite

URL Masking with DNS and/or Mod_Rewrite?

I want to setup a system so that multiple custom domains like [mydomain.com/params] will redirect to [myapp.com/mydomain.com/params]. Can I do this using only DNS settings? I'm guessing that is not possible, so would it be a better solution to direct mydomain1.com, mydomain2.com, mydomain3.com, etc. to one IP address then use Mod_Rewri...

How to identify if referrer is a 301 redirect

I'm implementing a slug system for my website at the moment. I plan to redirect invalid slugs to the correct on that is stored in the database. E.g. http://example.com/11/wrong-slug Hit db, check if 11's slug is wrong-slug if not do 301 redirect http://example.com/11/right-slug Detect 301 and inform user that they foll...

Apache AllowOverride equivalent in Lighttpd

I've put a .htaccess file in my main directory of my lighttpd website like this: url.rewrite-once = ( "^/cat.php$" => "index.php" ) And I have enabled mod_rewrite and mod_redirect in my lighttpd.conf and restarted lighttpd server. But unfortunately when i type mydomain/cat.php i got error page 404. I've found that in Apache ther...

Redirect en.example.com to example.com/index.php?language=en

I would like redirect addresses that start with: en.example.com/somefile.php to: example.com/somefile.php?language=en Using mod_rewrite module in lighttpd. Until now I got this: $HTTP["host"] =~ "^en\.(.*)\.com$" { url.rewrite-once = ( "^/(.*)" => "/$1?language=en" ) ...

.htaccess - RewriteCond problems

Hi guys, There is a problem with my .htaccess file. If I type in "website.com" it redirects me correctly to "www.website.com", but if I type in "website.com/level1/level2" it redirects me to "www.website.com/index.php/level2" and gives me a 404 error. Here is what I have in my .htacces file: Options +FollowSymLinks IndexIgnore */* Re...

.htaccess subdomain and /

username.domain.com/file rewrite to domain.com/q.php?user=username&url=file how do that? Thanks. Sorry for my English. ...

how do I create the following .htaccess file

I have written the following code in my .htaccess file Options +FollowSymLinks RewriteEngine on RewriteRule page/(.*)/ index.php?page=$1&%{QUERY_STRING} RewriteRule page/(.*) index.php?page=$1&%{QUERY_STRING} The url "xyz.in/index.php?page=home" will look like this in the address bar of browser "xyz.in/page/home" If I want to pass a ...

URL rewriting problem

In order to convert dynamic URLs on my site www.kitesmovie.co.in to static urls. Eg: www.kitesmovie.co.in/stories.php?id=10 to www.kitesmovie.co.in/Barbara_Mori_Hrithik_Roshan_New_Movie. I tried using rewriting rules in my htaccess files, but it did not work. Please tell me how to do this. Thanks a lot in advance. ...

Rewriting URLs with Mod-Rewrite

How would I rewrite: http://localhost/profile.php?user=MaFi to http://localhost/user/MaFi ...

Apache Mod-Rewrite Question

I have a PHP scripted named index.php inside a folder named blog. There are three different views. http://www.myDomain.com/blog/index.php http://www.myDomain.com/blog/index.php?tags=list of categories http://www.myDomain.com/blog/index.php?post=name of post I would like to change the view based on the URL. /blog redirects to numbe...

mod_rewrite: how to point to a different file but keep the query vars ?

I have these rewriteRules which work fine: # 4 params RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?app=$1&do=$2&what=$3&id=$4 [NC,L,QSA] # 3 params RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?app=$1&do=$2&what=$3 [NC,L,QSA] # 2 params RewriteRule ^([A-Za-z0-9-]...

mod_speling & mod_rewrite to work together?

CheckSpelling On RewriteEngine on RewriteCond %{HTTP_HOST} ^([^.]+)\.site\.com$ RewriteCond /home/%1/ -d RewriteRule ^(.+) %{HTTP_HOST}$1 RewriteRule ^([^.]+)\.site\.com/media/(.*) /home/$1/data/media/$2 RewriteRu...

PHP: .htaccess 301 redirect not working

I have a basic CMS in PHP/MySQL where content managers can create pages to the system for public viewing. Each page is then available at an url such as http://www.example.com/pages.php?pid=123 Now, I want to redirect requests to http://www.example.com/pages.php?pid=123 to http://www.example.com/pages.php?pid=456. I've already removed th...

.htaccess mod rewrite automatically using php or something?

I've got a number of users, each with the website page like http://www.mysite.com/folder/artist%5Fid.php?id=33 The users need to be able to set their own easy URL such as http://www.mysite.com/userguy that would redirect to the above page. I know how to write these out manually in .htaccess with RewriteRule but, for example, users have...

Redirect 301 & Mod Rewrite Issues

I have a online store that, for example, is located here: hxxp://domain.com/store/ Within the store directory's .htaccess file I have this: Options +FollowSymlinks RewriteEngine on RewriteBase /store/ RewriteCond %{HTTP_HOST} !^www.domain.com$ RewriteRule ^(.*)$ http://www.domain.com/store/$1 [R=301] RewriteRule ^/?$ directory.php Rewr...

Mod Rewrite Clean URL's

How can I transform: http://example.com/about.php http://example.com/hello/deep.php http://example.com/hello/world/deeper.php Dynamically, into URLs like: http://example.com/about/ http://example.com/hello/deep/ http://example.com/hello/world/deeper/ ...

Apache ReWrite rule to exclude an individual file or type of file?

Can you help me with an Apache rule to exclude a particular file name or type of file? Here are my current rules: RewriteRule ^/(?:blog)/ - [L] RewriteRule ^crossdomain\.xml$ - [L] (Based on first response) RewriteRule ^/(.*_css.*\.css.*) /$1 [QSA,L] RewriteRule ^/(.*_js.*\.js.*) /$1 [QSA,L] RewriteRule ^/(.*_swf.*\.swf.*) /$1 [QSA,L]...

Location Bar Doesn't Show Redirected URL

This is my httpd.conf file for my http://old.example.com : RewriteEngine on RewriteBase / RewriteRule ^login$ http://another.example.com/login [L] The problem is that although I can redirect to http://another.example.com/login, but the location bar is still showing http://old.example.com/login. Any idea how to fix this? ...

Multiple RewriteConds and RewriteRule Stacked Together

I have this apache rewrite rule: RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} mycompany.com RewriteRule ^$ http://mycompany.com/login [L] # we check if the .html version is here (caching) RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f # no, so ...

mod_rewrite - need help with friendly URL

How would you mod_rewrite a url to go from directory.php?id=4 to directory/category/city/name/4/ I took a stab in the dark with RewriteRule ^directory/*/*/*/([^/\.]+)/?$ directory.php?&id=$4 But not working obviously. Any help is greatly appreciated ...