.htaccess is not rewriting my url - apache

i'm quite new to .htaccess file and I nees a bit of help..
I have a Greek site and I want to have urls like επικοινωνία.html. However, I haven't managed to translate successfully using htaccess file.
My code, for example, is:
Options +FollowSymlinks
RewriteEngine On
RewriteRule επικοινωνία.html contact.html
However, the url showing in the browser is not changing at all.
What am I missing?

Try this code:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^επικοινωνία\.html$ /contact.html [L,B,R]

Related

Mod_rewrite rewrite URL doesn't do anything

For some reason Apache doesn't rewrite my URL's and I can't figure out what's wrong.
I can confirm that mod_rewrite works because this works:
RewriteEngine on
RewriteRule ^oranges.html$ apples.html
And it shows the apples.html page.
I am trying to use this but it doesn't do anything!
Options -Multiviews +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9]+)[/]*$ index.php?page=$1
To look like this: http://example.com/search/
What could be wrong here? :o

Htaccess redirect or rewrite

I'm in the process of testing a site at a preview URL until the DNS transfers over. I'm previewing the site at http://IP_ADDRESS/~name/.
All of my images that have been uploaded in the CMS are listed like <img src="/uploads/images/">.
But this doesn't work while i'm on the preview URL. So ideally I need to redirect /uploads/* to /~name/uploads/*
I was wondering if this should be a redirect or a rewrite in htaccess and what the rule might be?
Thanks.
This is the code you'll need in your .htaccess under DOCUMENT_ROOT:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^uploads/ ~name%{REQUEST_URI} [L,NC]

apache mod rewrite

Need some help with a rewrite please.
I have domain http://www.example.com. There are multiple folders within the root. I'd like to rewrite http://www.example.com/folder1/public/index.php to http://www.example.com/folder1
I dont have access to the main apache config so i'll need to do this in a .htaccess. If possible I'd also like to place the .htaccess inside folder1, not in the root.
Any help would be awesome, thanks.
Thinking monkey is close. Try:
Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine On
RewriteBase /folder1
RewriteRule ^(?!public/)(.*) public/$1 [L]
You need the RewriteBaseand you need to stop recursive evaluation of the rule. The (?!public/) bit just means don't match anything already starting with public/. You need this sort of guard in .htaccess rules.
I presume you are trying to redirect any request to folder1 to folder1/public.
By that I mean, you want your URLs to look like http://www.example.com/folder1 while the actual URL will be http://www.example.com/folder1/public/index.php.
First of all, you have to use http://www.example.com/folder1 in your hrefs and rewrite this to http://www.example.com/folder1/public/index.php.
Add the below to your .htaccess residing in your folder folder1.
Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]

absolute links and mod_rewrite

I want to use mod_rewrite and I set everything up to use "absolute links" in order to overcome URL resolving issue. Now my links look like (/file.php) instead of (./file.php) and everything works ok on localhost.
Unfortunately, when I put the project on my actual server, links are not valid anymore so I want to know where "/" is pointing to and how to resolve this issue.
(I do not want to use html base tag at this point.)
localhost: http://project.local
Actual host: http://project.com
And here is what I have in my .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^page/([0-9-]*) /home.php?page=$1 [QSA,L]
try using rewritebase
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^page/([0-9-]*) /home.php?page=$1 [QSA,L]

Apache redirects: do not redirect if URL contains

i have a situation where i want to prevent any redirects if the URL contains "akamai"
Basically, if URL contains akamai do not redirect.
Any ideas?
Your requirements are not very clear.
Try this code in your .htaccess file:
Options -MultiViews +FollowSymLinks
RewriteEngine On
RewriteRule ^(.+)(?<!akamai)$ /akamai-$1 [L,NC]
Negative lookbehind (?akamai.