I would like to know, how can i rewrite an URL without the 302 redirection.
The website is targeted by 2 domains.
- The first domains `(domain1.com)` focus all the website.
- The second domains `(domain2.com)` focus only one function to do an url shortener
Here is my `.htaccess` :
Code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2.com$
RewriteRule ^([A-Za-z0-9-]+)$ http://domain2.com/url/$1 [L]
Rewritecond %{HTTP_HOST} domain2.com [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://domain2.com/soon/ [QSA,L,R=301]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
When i call my shothener `http://domain2.com/57b97f2` i'am redirect to `http://domain2.com/url/57b97f2` with a 302 redirection.
How can i avoid this unwanted 302 redirection ?
My controller for the `url()` function is named : `webadmin`
My routes are :
Code:
$route['default_controller'] = 'webadmin';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['(.+)'] = 'webadmin/$1';
Webadmin controller :
Code:
function url($code)
{
//do something
}
EDIT :
I try to use :
Code:
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$
RewriteRule ^$ /soon [R=302,L]
RewriteCond %{HTTP_HOST} ^(www\.)?domain2\.com$
RewriteRule ^([a-z0-9-]+)$ /url/$1 [NC,N]
But an 404 error is showing...