I have a htaccess file to match all of the occurrences. but it stops at second one. when i load /galeri/kategori/galeri-kategory-albumname/ it loads sayfa.php which has no relation with gallery page itself. It works fine on my localhost but trying to figure out why its not working in server.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)$ index.php?p=$1 [L]
RewriteRule ^(.*?)\/sayfa(.*?)$ index.php?p=$1&sayfa=$2 [L]
RewriteRule ^(.*?)\/kategori\/(.*?)\/$ index.php?p=$1&kategori=$2 [L]
RewriteRule ^(.*?)\/kategori\/(.*?)\/(.*?)\/$ index.php?p=$1&kategori=$2&sayfa=$3 [L}
Have it this way:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(.*)/kategori/(.*)/(.*)/?$ index.php?p=$1&kategori=$2&sayfa=$3 [L,QSA]
RewriteRule ^(.*)/kategori/(.*?)/?$ index.php?p=$1&kategori=$2 [L,QSA]
RewriteRule ^(.*)/sayfa(.*?)/?$ index.php?p=$1&sayfa=$2 [L,QSA]
RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
Related
Clean URLs works only on index.php but not on the other pages (explore and top).
The parameter I want to "clean" is 'genre' (for example: genre=pop). This is the website:swiftlymusic.com and is hosted on a "1&1(1and1 oneandone)" server.
.htaccess:
ErrorDocument 404 /04.html
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^log$ logs [L]
RewriteRule ^([a-zA-Z0-9]+)$ ?genre=$1 [L]
RewriteRule ^([a-zA-Z0-9]+)/$ ?genre=$1 [L]
RewriteRule ^explore/([a-zA-Z0-9_-]+)$ explore.php?genre=$1 [L]
RewriteRule ^top/([a-zA-Z0-9_-]+)$ top.php?genre=$1 [L]
AddDefaultCharset UTF-8
Try it like this,
Options -Multiviews
ErrorDocument 404 /04.html
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^log$ logs [L]
RewriteRule ^([\w-]+)$ ?genre=$1 [L]
RewriteRule ^([\w-]+)/$ ?genre=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#explore & top and any other can be use by this 1 rule
RewriteRule ^([\w]+)/([\w-]+)$ $1.php?genre=$2 [QSA,L]
Have you tried re-ordering so that the "explore.php" and "top.php" lines are above the general line? Also, you can use '?' instead of repeating the line twice: once with, once without the forward slash.
RewriteRule ^explore/([a-zA-Z0-9_\-]+)/?$ explore\.php?genre=$1 [L]
RewriteRule ^top/([a-zA-Z0-9_\-]+)/?$ top\.php?genre=$1 [L]
RewriteRule ^([a-zA-Z0-9]+)/?$ ?genre=$1 [L]
When user types:
www.domain.com/standard/Public/Modules/home.php or
www.domain.com/standard/Public/Modules/contacts.php
(or anything that follows the same pattern)
I want the URL to be displayed like this:
www.domain.com/home
www.domain.com/contacts
...
My current .htaccess:
RewriteEngine on
RewriteRule ^home.php/?$ standard/Public/Modules/home.php [NC,L]
RewriteRule ^contacts.php/?$ standard/Public/Modules/contacts.php [NC,L]
You need to have this in your root .htaccess:
RewriteEngine on
RewriteCond %{THE_REQUEST} /standard/Public/Modules/login\.php [NC]
RewriteRule ^standard/Public/Modules/login\.php$ /home [L,NC,R=301]
RewriteCond %{THE_REQUEST} /standard/Public/Modules/logout\.php [NC]
RewriteRule ^standard/Public/Modules/logout\.php$ /contacts [L,NC,R=301]
RewriteRule ^home/?$ /standard/Public/Modules/login.php [NC,L]
RewriteRule ^contacts/?$ /standard/Public/Modules/logout.php [NC,L]
I use this, no need to individually set rewrites for pages
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
For example
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)-product(.*).html$ /products/view/$2 [L]
RewriteRule ^(.*)-cat(.*).html$ /products/listing/$2 [L]
RewriteRule ^products.html$ /products/listing/ [L]
RewriteRule ^bioproducts.html$ /products/bio_listing/ [L]
RewriteRule ^aboutus.html$ /static/index/15 [L]
RewriteRule ^contacts.html$ /static/contacts [L]
RewriteRule ^(.*)-partners(.*).html /partners/index/$2 [L]
</IfModule>
I have the following rules setup for my blog and they seem to work just fine.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(index\.php|(modules|css|files|fonts|ico|img|js)/)
RewriteRule ^([^/]*)/page/([^/]*)$ /framework/?p=$1&page=$2 [L]
RewriteRule ^([^/]*)/search/([^/]*)$ /framework/?p=$1&search=$2 [L]
RewriteRule ^([^/]*)/search/([^/]*)/page/([^/]*)$ /framework/?p=$1&search=$2&page=$3 [L]
So I was feeling confident and wanted to add one more rule for the just the basic page.
so I added this rule
RewriteRule ^([^/]*)$ /framework/?p=$1 [L]
so that my htaccess file now looks like this
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(index\.php|(modules|css|files|fonts|ico|img|js)/)
RewriteRule ^([^/]*)$ /framework/?p=$1 [L]
RewriteRule ^([^/]*)/page/([^/]*)$ /framework/?p=$1&page=$2 [L]
RewriteRule ^([^/]*)/search/([^/]*)$ /framework/?p=$1&search=$2 [L]
RewriteRule ^([^/]*)/search/([^/]*)/page/([^/]*)$ /framework/?p=$1&search=$2&page=$3 [L]
but for if I go to http://www.example.com/framework/blog I get a 500 Internal Server Error if I take out the line and go to http://www.example.com/framework/blog/page/2 it loads my second page without any issues.
I am not sure what I am doing wrong? Any advice would be appreciated.
You can use:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /framework/
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/page/([^/]*)$ ?p=$1&page=$2 [L,QSA]
RewriteRule ^([^/]+)/search/([^/]*)/page/([^/]*)$ ?p=$1&search=$2&page=$3 [L,QSA]
RewriteRule ^([^/]+)/search/([^/]*)$ ?p=$1&search=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ ?p=$1 [L,QSA]
I would like to have a RewriteRule match the "base" url/path of my site.
My base URL, once in prod, will be something like http://www.site.com, but is currently http://localhost/dev/site/ in dev. .htaccess file is in the "site" folder.
In the following examples, the first RewriteRule is the problem, and I can't get it to work. The 2nd and 3rd RewriteRules work fine. I need it to bring to index.php?l=default&rte=index if I reach the base path/URL.
Thanks.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/$ index.php?l=default&rte=index [NC,L]
RewriteRule ^([a-zA-Z]{2})/$ index.php?l=$1&rte=index [NC,L]
RewriteRule ^([a-zA-Z]{2})/([a-zA-Z-]+)$ index.php?l=$1&rte=$2 [NC,L,QSA]
Try these rules:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteRule ^/?$ index.php?l=default&rte=index [QSA,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([a-zA-Z]{2})/?$ index.php?l=$1&rte=index [QSA,L]
RewriteRule ^([a-zA-Z]{2})/([a-zA-Z-]+)/?$ index.php?l=$1&rte=$2 [QSA,L,QSA]
i have a rewrite rule.
RewriteRule ^pages/(.+)$ info_pages.php?page_url=$1 [L]
this was working well Before.
my url like this but at localhost
http://dressgirls.com/demo2/pages/contact-us.html
this pointing to
http://dressgirls.com/demo2/info_pages.php
when i use this
echo $_GET['page_url'];
it gives me. contact-us.html/contact-us.html/contact-us.html
it should give contact-us.html one time only.
do you have idea what is wrong here.?
This is full code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^pages/(.+)$ info_pages.php?page_url=$1 [L]
RewriteRule ^reviews/(.+)$ edit_review.php?review_id=$1 [L]
RewriteRule ^deals/(.+)$ category.php [L]
RewriteRule ^city/(.+)$ location_deals.php [L]
#RewriteCond %{REQUEST_FILENAME} =-f
#RewriteRule ^(.*)\.php$ $1.html [NC,L]
#RewriteRule ^(.*)\.html$ $1.php [NC,L]
RewriteCond %{REQUEST_FILENAME} ^(.*)\.html$
RewriteCond %1.php -f
RewriteRule ^(.*)\.html$ $1.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ deal-detail-page.php [QSA,L]
</IfModule>
Thanks.
Change code to:
RewriteBase http://dressgirls.com/
RewriteRule ^pages/(.+)$ info_pages.php?page_url=$1 [L]
and try.