LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2011, 04:21 PM   #1
Vodkaholic1983
Member
 
Registered: May 2010
Distribution: Windows / Debian
Posts: 163

Rep: Reputation: 0
.htaccess questions


First question than I been trying to re-write some url's this is what i have so far

Code:
RewriteRule /blog/(.*) /my_tutorials$1 [NC]
RewriteRule /blogs/(.*) /tutorials$1 [NC]
RewriteRule /entries/(.*) /tutorial$1 [NC]
Which someone made for me as I am clueless about this kind of code (even after hour's googling)
Anyone any idea why this will not work for me?
Am trying to rewrite three urls

/blog
/blogs
/entries


Second question
I run a site with mass image's (alot very lot)
Is there something i should add in my htaccess to help with this ive read about headers or something like that atm all I have is this in it at the mo

Note this is not the same htaccess as the one above ^_^
Code:
<IfModule mod_dir.c>
	DirectoryIndex index.php5 index.php
</IfModule>

<FilesMatch "\.(sqlite|sdb|s3db|db)$">
	Deny from all
</FilesMatch>

<IfModule mod_rewrite.c>
	RewriteEngine  on

	# rather than link to images/ha/hash and have an ugly filename,
	# we link to images/hash/tags.ext; mod_rewrite splits things so
	# that shimmie sees hash and the user sees tags.ext
	RewriteRule ^_images/([0-9a-f]{2})([0-9a-f]{30}).*$  images/$1/$1$2 [L]
	RewriteRule ^_thumbs/([0-9a-f]{2})([0-9a-f]{30}).*$  thumbs/$1/$1$2 [L]

	# any requests for files which don't physically exist should be handled by index.php
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^(.*)$ index.php?q=$1&%{QUERY_STRING} [L]
</IfModule>

<IfModule mod_php5.c>
	php_flag register_globals 0 
	php_flag magic_quotes_gpc 0 
	php_flag magic_quotes_runtime 0
</IfModule>

DefaultType image/jpeg

<IfModule mod_expires.c>
	ExpiresActive On
	ExpiresDefault "access plus 1 month"
	ExpiresByType text/html "now"
	ExpiresByType text/plain "now"
</IfModule>

<ifmodule mod_deflate.c>
	AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
	AddOutputFilterByType DEFLATE application/x-javascript application/javascript
</ifmodule>
Thanks for looking

Last edited by Vodkaholic1983; 02-24-2011 at 04:22 PM.
 
Old 02-24-2011, 05:12 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,252

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
You need slashes. Or was this a typo?
Code:
RewriteRule /blog/(.*) /my_tutorials/$1 [NC]
RewriteRule /blogs/(.*) /tutorials/$1 [NC]
RewriteRule /entries/(.*) /tutorial/$1 [NC]
 
Old 02-24-2011, 05:26 PM   #3
Vodkaholic1983
Member
 
Registered: May 2010
Distribution: Windows / Debian
Posts: 163

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by eSelix View Post
You need slashes. Or was this a typo?
Code:
RewriteRule /blog/(.*) /my_tutorials/$1 [NC]
RewriteRule /blogs/(.*) /tutorials/$1 [NC]
RewriteRule /entries/(.*) /tutorial/$1 [NC]
No that was not a typo thanks
just tryed it with them still the same
Thanks tho
 
Old 02-25-2011, 05:41 AM   #4
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,252

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
Test this variants:
Code:
RewriteRule blog/(.*) /my_tutorials/$1 [NC]

or

RewriteRule blog/(.*) my_tutorials/$1 [NC]

or

RewriteBase /
RewriteRule blog/(.*) my_tutorials/$1 [NC]
 
Old 02-25-2011, 01:40 PM   #5
Vodkaholic1983
Member
 
Registered: May 2010
Distribution: Windows / Debian
Posts: 163

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by eSelix View Post
Test this variants:
Code:
RewriteRule blog/(.*) /my_tutorials/$1 [NC]

or

RewriteRule blog/(.*) my_tutorials/$1 [NC]

or

RewriteBase /
RewriteRule blog/(.*) my_tutorials/$1 [NC]
hmm still didn't work mate
 
Old 02-25-2011, 04:31 PM   #6
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,252

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
So, post your directory structure, Apache configuration and version. And what exactly error web browser give you? You can also switch on a logging of mod_rewrite.
 
Old 02-26-2011, 10:06 PM   #7
Vodkaholic1983
Member
 
Registered: May 2010
Distribution: Windows / Debian
Posts: 163

Original Poster
Rep: Reputation: 0
Hey i found out there was some rewrite on allready ><

/index.php?blogs/
/index.php?blog/vodkaholic.1/
/index.php?entries/test.1/
/index.php?blogs/create-entry

These are the unchanged url's if you still need the above I will have a look for the info for you

Thank's for helping
 
Old 02-27-2011, 08:19 AM   #8
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,252

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
Well, ealiers entries should not affect subsequent rewrites, as rewrite engine start again with the new URL, however I had some annoying inconsistents with Apache v1.3. If you do not need the old rewrite, replace them with the new.
 
  


Reply

Tags
htaccess, questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
(noob questions) cgi-bin for .htaccess hebeles Programming 1 12-28-2010 08:50 AM
[SOLVED] Need help with .htaccess guessity Programming 5 10-22-2010 03:06 AM
A few questions regarding .htaccess Seventh Linux - Security 2 01-20-2006 07:17 AM
.htaccess questions lothario Linux - Security 1 01-24-2005 08:50 PM
.htaccess pk21 Linux - Software 3 09-23-2002 09:23 AM


All times are GMT -5. The time now is 12:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration