Solved

redirect url .htaccess

Posted on 2013-11-13
5
627 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
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Dontmilkthis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thnx,
adding RewriteCond %{REQUEST_URI} ^/gallery/$
did the trick
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now