LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   .htaccess questions (https://www.linuxquestions.org/questions/linux-newbie-8/htaccess-questions-864841/)

Vodkaholic1983 02-24-2011 03:21 PM

.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

eSelix 02-24-2011 04:12 PM

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]


Vodkaholic1983 02-24-2011 04:26 PM

Quote:

Originally Posted by eSelix (Post 4270175)
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 :)

eSelix 02-25-2011 04:41 AM

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]


Vodkaholic1983 02-25-2011 12:40 PM

Quote:

Originally Posted by eSelix (Post 4270719)
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 :(

eSelix 02-25-2011 03:31 PM

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.

Vodkaholic1983 02-26-2011 09:06 PM

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

eSelix 02-27-2011 07:19 AM

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.


All times are GMT -5. The time now is 07:25 AM.