Hello everybody, I hope you can help me.. I've a homepage, the homepage has many version's because of many updates. In my main-dir it looks like this : -main --version ---12.02.2010 ---20.02.2010 etc.. Now I wan't to link the page if somebody's going on my site to the newest version. I thought it can be done with the mode_rewrite , I made something but the problem is, you can see that's in a subdir like this: http://www.domain.com/version/12.02.2010/index.php I want to have http://www.domain.com/index.php , is this posible? I hope you can help me out Thanks in advance.
Add this to the .htaccess file in your root directory: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/version/12.02.2010/ RewriteRule ^(.*)$ /version/12.02.2010/$1 Code (markup): Not tested but it should work.
He, THX but it didn't work. There isn't any error but the page isn't redirecting, it stays on the same root dir.
he sorry, I must give the index.php then it works, how would it work without to give index.php ? now it looks like this RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/ RewriteRule ^(.*)$ /version/2010.04.11.1/$1
Or is it possible to make from the url : http://www.domain.com/version/2010.04.11.1/ this : http://www.domain.com/ then it would also work I think, can somebody please help me. THX in Advance
Replace the rule with this one and let me know: RewriteRule ^([^/]*)$ ./version/2010.04.11.1/$1 [L] Code (markup):
My shared host lets me have access to all configs - PHP, Apache, etc. If yours allows this, just change DocumentRoot to public_html/latest and symlink your latest version to latest. If yours doesn't allow this, change to a better host.
thx for helping me, @nimonogi, I tried this, RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/ RewriteRule ^([^/]*)$ ./version/2010.04.11.1/$1 [L] Code (markup): but it still didn't work. @krsix, I didn't ask but I don't think they let me do this..
The problem is, that people can see the directory /version/2010.04.11.1/ and that's what keeps me off doing it.
Try this way: RewriteEngine On Options +FollowSymLinks DirectoryIndex index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/ RewriteRule ^(.*)$ /version/2010.04.11.1/$1 [L] Code (markup):
He nimonogi thank you very much but I still must give index.php at the end of the domain to get on the site, otherwise it doesn't show the page.
He thanks to you all, what nimonogi did was right except to let these 2 lines away: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Code (markup): It functions like this: RewriteEngine On Options +FollowSymLinks DirectoryIndex index.php RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/ RewriteRule ^(.*)$ /version/2010.04.11.1/$1 [L] Code (markup):
Thx very much but I've got another question, I'm searching for this about 2 hours. I wan't the redirecht in PHP to this version/2010.04.11.1/ dir which is no problem. In this dir 2010.04.11.1 I want to have a htaccess file in this dir 2010.04.11.1 which is removing the version/2010.04.11.1 from the url. Do you know how this would work? because I've problem when I redirect the page with htaccess in the root dir, then I can't get acces the a newer version( e.x. 2010.04.12.1 ). Thank you in advance.
This should do the trick: RewriteEngine On Options +FollowSymLinks DirectoryIndex index.php RewriteCond %{REQUEST_URI} !^/version/2010.04.12.1/ RewriteCond %{REQUEST_URI} !^/version/2010.04.11.1/ RewriteRule ^(.*)$ /version/2010.04.11.1/$1 [L] Code (markup): This code should replace the previous discussed.