Do you know how to edit the script so it includes the site name in the URL? is view_video.php in domain.com/view/view_video.php or domain.com/view_video.php ? I'm guessing .htaccess is at domain.com/.htaccess See if it works if .htaccess only has Options +FollowSymLinks +Indexes RewriteEngine On RewriteBase / RewriteRule ^view/([^.]+)/([^.]+)/([^.]+)\.html$ view_video.php?viewkey=$1&page=$2&viewtype=&category=$3 [L] RewriteRule ^view/([^.]+)/([^.]+)\.html$ view_video.php?viewkey=$1&page=$2&viewtype=&category= [L] RewriteRule ^view/([^.]+)\.html$ view_video.php?viewkey=$1 [L] You can't redirect to another page and make the new URL keep showing the old page. Just link to http://subdomain.domain.com/dir/dir/dic if it's an actual page.
Yes i know how to edit the script. I need to know the .htaccess edit, not any other script. Would you tell me would the below do? Or do i miss something. Thanks in advance.
I have revamped a section of my site contained in one directory and moved to a completely different script in another directory to run it. Now after several weeks of work I want to take the new part live but can't seem to get first part of redirects to work The original URL's look like this domain.com/community/recipes/viewrecipe.php?id=3113 Now in the new directory that same page has a URl that looks like this. domain.com/cooking/recipe/3113/cauliflower-in-tomato-sauce.html Now after following this great guide I have an htaccess in the original directory that looks like this Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^/cooking/recipe/(.*)/(.*)\.html$ /community/recipes/viewrecipe.php\?id=$1 [R=301,L] So, of course after several tries, several changes, I still can't find a way to get it to work for some reason. I would more than seriously appreciate a solution to my continued ignorance and an end to be the frustration
RewriteRule ^detail/(.*)/(.*)\.html$ detail.php?link=$1 [L] if detail.php?link=884 is the original URL. RewriteRule ^community/recipes/viewrecipe.php\?id=(.*)$ cooking/recipe/$1/$2 [R=301,L] Except there's no way you can redirect it cause it'll have no idea what $2 is. All you can do is link to domain.com/cooking/recipe/3113/cauliflower-in-tomato-sauce.html RewriteRule ^cooking/recipe/(.*)/(.*)\.html$ community/recipes/viewrecipe.php?id=$1 [L]
Yes it set to detail.php?link=884. But it seem still cant work, even on a testrun website. Not sure whether i miss place it here : Options -Indexes Options +FollowSymLinks DirectoryIndex index.php index.html <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ index.php [QSA,L] Rewritecond %{http_host} ^domain.com [nc] Rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] RewriteRule ^detail/(.*)/(.*)\.html$ /detail.php?link=$1 [L] </IfModule> Code (markup): Did i put it in the correct place? Cos when hover on the link or clicking on the link its still showing detail.php?link=123
Hello again. Is there any way to be able to use RewriteCond as well as the rules with this code on my site? I've been trying so many different combinations left and right with just the RewriteRule and nothing has worked, yet when I've began experimenting with the RewriteCond on top of it (using Query_String or whatever), I can sometimes get my server to give an Internal Error message, so I know it's reading the .htaccess file and whatnot, I'm just not getting the code correct. Thanks.
Say you were to do this code.. RewriteRule ^index.htm$ http://www.domain.com/ [R=301,L] Code (markup): But wanted to redirect a page to another page on the same domain and same server, would you still have to do the R=301? I've been doing it this whole time with just [L]..
Grrr...what is wrong with my code? RewriteRule ^free\-web\-directories.html$ free_web_directories.html [L] RewriteRule ^premium\-web\-directories.html$ premium_web_directories.html [L] RewriteRule ^premium\-web\-directory\-submission\-report.html$ premium_web_directory_submission_report.html [L] RewriteRule ^manual\-directory\-submission.html$ manual_directory_submission.html [L] RewriteRule ^sponsor\-directory\-lister.html$ sponsor_directory_lister.html [L] Code (markup):
Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^free\-web\-directories\.html$ free_web_directories.html [L] RewriteRule ^premium\-web\-directories\.html$ premium_web_directories.html [L] RewriteRule ^premium\-web\-directory\-submission\-report\.html$ premium_web_directory_submission_report.html [L] RewriteRule ^manual\-directory\-submission\.html$ manual_directory_submission.html [L] RewriteRule ^sponsor\-directory\-lister\.html$ sponsor_directory_lister.html [L] You can see if you can get it working with... RewriteRule ^wacko\.html$ index.html [L] Now, go make a few more polls!!!
If you use a full URL instead of a path, the rewrite engine cannot tell that the destination is actually on the same server and still accessible so it has no choice but to send out a redirect header for the new location. The default redirect status is a 302 for temporary redirects so if you're doing SEO work, you probably want to specify 301 by explicitly using the R flag and giving it the 301 value. The dash isn't strictly speaking a metacharacter and so doesn't need escaping, unless of course it's positioned within a class where it's meaning could be confused.. i.e [a\-g] matches a, the dash and g, whereas [a-g] matches every letter between a and g alphabetically. But if you wanted the former, it's easier to just write [ag-]. In this instance, it can only possibly be a literal dash so the backslash is unnecessary. Whether that's your problem or not, I don't know but maybe worth trying without.
Yeh, not working.. I'm trying to redirect http://www.directorylister.info/premium_web_directories.html for example to http://www.directorylister.info/premium-web-directories.html
Your code is all wacked if you're trying redirects!!! Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^free_web_directories\.html$ free-web-directories.html [R=301,L] for an example
Full URL... Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^free_web_directories\.html$ http://www.directorylister.info/free-web-directories.html [R=301,L] or try a little test Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^wacko\.html$ index.html [L] http://www.directorylister.info/wacko.html
Dat don't work!! http://www.directorylister.info/free_web_directories.html is NOT being redirected to http://www.directorylister.info/free-web-directories.html !!!
Try da little test!!! If that then works, try RewriteRule ^wac_ko\.html$ http://www.directorylister.info/index.html[R=301,L]