How would i go about creating an splash page that would be the first page when someone goes to the site. The site is built on socialengine.
I guess it doesn't have to be html, could be php.
I have tried updating the htaccess file with DirectoryIndex index.html
Adding redirect code, (broke site)
Any ideas?
Figured it out by another post, it wasn't for an html page but i modified it and works.
Your main .htaccess file
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) main.html [L,QSA]
RewriteCond %{REQUEST_URI} /index.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} .(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]
FileETag Size
Related
Recently i Modified my .htaccess file in my apache server. and this is the following code
RewriteEngine On
<IfModule mod_speling.c>
CheckSpelling On
</IfModule>
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^course/([^/.]+)$ course.php?name=$1 [QSA,L]
RewriteRule ^course/([^/.]+)/$ course.php?name=$1 [QSA,L]
RewriteRule ^about$ about.php [QSA,L]
RewriteRule ^about/$ about.php [QSA,L]
RewriteRule ^contact$ contact.php [QSA,L]
RewriteRule ^contact/$ contact.php [QSA,L]
RewriteRule ^downloads$ downloads.php [QSA,L]
RewriteRule ^downloads/$ downloads.php [QSA,L]
RewriteRule ^ errors/404.html [L,NC]
Now the Problem is
If I I enter the URL like http://localhost/about in my web browser it well always shows the custom 404.html
I think the problem is on the last line.
If i remove the last line it will works.
But I also want the 404 page. Like If the user enters http://localhost/SomeRandomString the 404 page show on this url.
I also tried ErrorDocument on .htaccess file but it will change the url
Is any solution for this problem.
Have your htaccess rules file in following way. Place it in your root directory, make sure to clear your browser cache before checking your URLs.
RewriteEngine On
<IfModule mod_speling.c>
CheckSpelling On
</IfModule>
##Rules that cover your uris starting with course here.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(course)/([^/.]+)/?$ $1.php?name=$2 [NC,QSA,L]
##Rules that cover your uris starting with about/contact/downloads here.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(about|contact|downloads)/?$ $1.php [NC,QSA,L]
##Rules that cover all uris which aren't matching any of the above conditions.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ errors/404.html [L,NC,QSA]
I have two language /ru and /uk. /uk is the default.
I need to remove /uk from the URL.
For example:
www.example.com.ua/uk/category
to
www.example.com.ua/category
But any URL with /ru must not change. ie. www.example.com.ua/ru/category.
htaccess look like
DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^init.php$ - [F,L,NC]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(favicon|apple-touch-icon-|homescreen-|firefox-icon-|coast-icon-|mstile-).*\.(png|ico)$ - [R=404,NC,L]
RewriteCond %{REQUEST_URI} ^api/(.*)$ [or]
RewriteCond %{REQUEST_URI} .*/api/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*api/(.*)$ api.php?_d=$1 [L,QSA]
RewriteCond %{REQUEST_URI} \.(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [NC,or]
RewriteCond %{REQUEST_URI} store_closed.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)\/(.*)$ $2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
In order to remove the /uk path segment from the start of the URL-path then you would need to do something like the following at the top of your .htaccess file:
RewriteRule ^uk/(.*) /$1 [R=302,L]
This does assume that you have already modified all your internal links and canonical tags to remove the /uk path segment.
If this is intended to be permanent then change the 302 (temporary) redirect to 301 (permanent) only once you have confirmed that everything works as intended, so as to avoid potential caching issues.
Cannot use (!) reverse operation, a redirect URL (http://ssvwv.com) will appear:
/1/3/ktrb
Will not display (index.html)
RewriteEngine on
RewriteCond %{REQUEST_URI} !^\/1\/(?:1|2|3)\/.*$
RewriteRule ^(.*)$ http://ssvwv.com/ [L,R=302,NE]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule . /index.html [L]
This should work for you:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(?:index\.html|1/[1-3]/.*)$ [NC]
RewriteRule ^ http://ssvwv.com/ [L,R=302]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.html [L]
Issue is that last rule is rewriting to /index.html and when mod_rewrite loops again URI becomes /index.html and RewriteCond %{REQUEST_URI} !^\/1\/(?:1|2|3)\/.*$ returns true thus redirecting to http://ssvwv.com/. That's why you need to skip /index.html from first rule as well.
I want a second website in my domain inside the folder test
www.mydomian.com/test
Apache server running on linux.
But when I load it in my navigator styles, images, helpers can't be found.
My htaccess is like this:
RewriteEngine On
RewriteBase /test
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /test/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Thank you in advance
I have tried what you said, placing the htaccess file you gave me in the test folder and the other one in the root directory, it didn't work.
Other options?
Try adding a .htaccess file into your test folder instead.
I use this .htaccess content:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
In the folder test I would place another .htaccess, with almost the same content:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test/index.php?/$1 [L]
My current .htacces file looks like this:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
What I am trying to accomplish (as well as the above) is to change a url such as http://domain.com/pages/pagename to something like http://domain.com/index.php/pages/view/pagename.
Keeping in mind that I still require urls without the /page/ part such as http://domain.com/search to go to http://domain.com/index.php/search. I am working with CodeIgniter.
What I have come up with so far is:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
RewriteCond %{REQUEST_URI} ^/pages/(.*)
RewriteRule ^(.*)$ ./index.php/pages/index/$1 [L,QSA]
But it isn't working.
Try this one:
RewriteEngine on
# do not do anything for already existing files
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
# /pages/ specific rule
RewriteRule ^pages/(.*)$ index.php/pages/index/$1 [L]
# everything else
RewriteRule ^(.*)$ index.php/$1 [L]
The above assumes that http://domain.com/pages/ is not a real folder.
RewriteRule ^pages/(.*) /index.php/pages/index/$1