i want rewrite /q.php?start=0&co=US&l=AL&s=hotel to /us/al/hotel
I tried this, but I get error - nothing found. and this my htaccess
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /q.php?start=0&co=$1&l=$2&s=$3 [L]
This should work for you
RewriteEngine On
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ /q.php?start=0&co=$1&l=$2&s=$3 [L]
Related
I have a link
http://www.mydomain.com/place/index.php?slug=antalya-hotels
and i want to write this like
http://www.mydomain.com/place/antalya-hotels.html
I have tried this
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /place/index.php?slug=$1 [L]
Bu didnt work. how we can do.
You can use:
RewriteEngine On
RewriteRule ^place/([^.]+)\.html$ /place/index.php?slug=$1 [L,QSA,NC]
OR
RewriteRule ^([^/]+)/([^.]+)\.html$ /$1/index.php?slug=$2 [L,QSA,NC]
I m sure that many people will say that this is duplicated but I try everything from other "Question"`s and nothings work for me.
The problem is that I move my project to the web server.
In this server I have folder "public_html" where I but my project Symfony.
Now to enter on my project I must write the following url: www.mydomain.com/Symfony/web/*
But I want to write a Rewrite Rule which will redirect from www.mydomain.com/Symfony/web/* to
www.mydomain.com/home/*.
To do this I try on 2 different ways with many combination of ReWrite rule.
In my public_html I create a .htaccess folder
I edit the .htaccess in Symfony/web folder
I add the following rule in both file but without success
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^Symfony/web/(.*)$ www.mydomain.com/home/$1 [L,R=301]
Unfortunately without success. What I`m doing wrong?
My htaccess file look like
And all the time Error 404 Object not found
Symfony/web/.htaccess
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Symfony/web/
RewriteCond %{THE_REQUEST} \s/+Symfony/web/ [NC]
RewriteRule ^(.*)$ /home/$1 [L,R=301]
RewriteRule ^home/(.*)$ $1 [L,NC]
</IfModule>
It`s redirecting me but I receive again Object not found :(
I delete the .htaccess in public_html folder which is the root one for my server
public_html\.htaccess
RewriteEngine On
RewriteRule ^home/(.*)$ /Symfony/web/$1 [L,NC]
1: Place this code in /Symfony/web/.htaccess:
RewriteEngine On
RewriteBase /Symfony/web/
RewriteCond %{THE_REQUEST} \s/+Symfony/web/ [NC]
RewriteRule ^(.*)$ /home/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [L]
2: Place this code in /public_html/.htaccess:
RewriteRule ^home/(.*)$ /Symfony/web/$1 [L,NC]
I'm going to go out on a limb and say that your rule is backwards. I think you want your URL to be www.mydomain.com/home/* in the browser... In which case the rule would be reversed. Also, your .htaccess should be in the root and you don't need to include the domain in the rewrite rule because you set a rewrite base.
RewriteRule ^home/(.*)$ Symfony/web/$1 [L,R=301]
First off I'm not an expert in htaccess stuff, but i try to accomplish the following for some SEO fixes.
When the url is loaded, without any params/rewrite it should get some data attached before it continues.
For example:
http://www.domain.com >>> http://www.domain.com/en/
I thought the rewrite was right like this, but didn't work (500)
RewriteCond %{REQUEST_URI} !^(en|nl|de|etc)$
RewriteRule ^(.*)$ /en/ [L,R=301]
added
RewriteRule ^(/?[^/]+) /index.php?rewrite=1 [L] # tell php we got a rewrite
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ $1/en/ [NC]
I have a URL that looks like this http://domain.com/index.php/view/test. How do i rewrite it so it doesn't have index.php/view in it. I just want it to look like http://domain.com/test. I want users to be able to type that short url directly in the browser
I tried the following in .htaccess but it's not working
RewriteEngine on
RewriteRule ^/$ index.php/view/
I'm running php 5.2.17
RewriteBase /
RewriteCond %{REQUEST_URI} !^/index.php/view/(.*)$
RewriteRule ^(.*)$ index.php/view/$1 [L]
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php/view/$1 [L]
Would do it if I understand you correctly.
I am trying to rewrite from
mysite.com/pokerbono/xyz
to
mysite.com/pokerbono.php?id=XYZ
Here is the code I added in the .htaccess:
#### Affiliate Links
RewriteRule ^pokerbono/([a-zA-Z0-9_-]+)$ pokerbono.php?id=$1 [L]
What is wrong with this rule? I tried like 100 variations and always receive a 404.
I tried each and every variation right now I have in my .htaccess the following rows:
RewriteRule ^pokerbono/([a-zA-Z0-9_-]+)$ pokerbono.php?id=$1 [L]
RewriteRule ^pokerbono/([a-zA-Z0-9_-]+)/$ pokerbono.php?id=$1 [L]
RewriteRule ^/pokerbono/([a-zA-Z0-9_-]+)$ pokerbono.php?id=$1 [L]
RewriteRule ^/pokerbono/([a-zA-Z0-9_-]+)/$ pokerbono.php?id=$1 [L]
RewriteRule ^/pokerbono/([a-zA-Z0-9_-]+)$ /pokerbono.php?id=$1 [L]
RewriteRule ^/pokerbono/([a-zA-Z0-9_-]+)/$ /pokerbono.php?id=$1 [L]
Try including slashes on the front:
RewriteRule ^/pokerbono/([a-zA-Z0-9_-]+)$ /pokerbono.php?id=$1 [L]
UPD:
This works in my environment:
RewriteEngine On
RewriteRule ^qwe/([-_a-zA-Z0-9]*)$ qwe.php?id=$1 [L]
I had to disable Multiviews, now it is working fine :)