Solved

redirect url .htaccess

Posted on 2013-11-13
5
686 Views
Last Modified: 2013-11-14
Hello experts

Quick question.

I'm using piwigo as a photo gallery site.
I want the frontpage to open a photo album and not the category view of albums.
I didn't find any piwigo way of doing it (or i must have overlooked it) so i'm looking to try it with .htaccess

I want my current URL :
http://www.mysite.com/gallery/
To default to:
http://www.mysite.com/gallery/index.php?/category/2

I tried

RewriteEngine on
RewriteRule ^ index.php?/category/2 [R,L]

this puts the homefolder path in the url to making it break
it becomes http://www.mysite.com/home/domains/mysite.com/gallery/index.php?/category/2

Can anyone give me a quick shout on what the correct rewriterule is for what i'm trying to achieve ?

Greetz
0
Comment
Question by:Th0R
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Dontmilkthis
ID: 39646610
Since it appears you want to redirect it to the same location every time, can you not just put the full URL in the redirect?

RewriteEngine on
RewriteRule ^ http://www.mysite.com/gallery/index.php?/category/2 [R,L]
0
 

Author Comment

by:Th0R
ID: 39646620
Hello

When i try that it creates a loop
The_page_is_not_redirecting_properly
0
 
LVL 5

Accepted Solution

by:
Dontmilkthis earned 500 total points
ID: 39646638
I'm guessing you'll need to put a RewriteCond on it then

if you check out this link there's a couple of basic examples - http://webmaster.iu.edu/tools-and-guides/maintenance/redirect-htaccess.phtml

you'll have to adjust this as required, but my first stab would be something like

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/gallery/$
RewriteRule ^ http://www.mysite.com/gallery/index.php?/category/2 [R,L]
0
 
LVL 12

Expert Comment

by:junipllc
ID: 39647761
You can also try (syntax not double-checked):

Redirect permanent /gallery/ /gallery/index.php?/category/2

Look up the Redirect syntax, though...I'm not sure if you need the leading slashes. Not even sure it will work, but I just wanted to throw this possibility out there in case you don't want to use mod_rewrite (even though you mentioned it in your question).

Cheers,

Mike
0
 

Author Closing Comment

by:Th0R
ID: 39649068
thnx,
adding RewriteCond %{REQUEST_URI} ^/gallery/$
did the trick
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to count occurrences of each item in an array.

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question