The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> System Administration
> Apache Development
|
mod_rewrite - Another basic rewrite help
Discuss Another basic rewrite help in the Apache Development forum on Dev Shed. Another basic rewrite help Apache Development forum discussing HTTP Server general topics, configuration, and modules. Apache is an open source web server that runs on multiple platforms.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 30th, 2012, 09:18 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 169
  
Time spent in forums: 1 Day 15 h 4 m 17 sec
Reputation Power: 14
|
|
|
mod_rewrite - Another basic rewrite help
im trying to make an imaginary filename rewrite to another file on the server. this i can work out using
RewriteRule ^temporay_filename.php /actualfile.php [NS,L]
now i need to redirect the actual file if it is accessed to display the temporary name so i thought i could just do
RewriteRule ^actualfile.php /temporay_filename.php [R=301]
then the errors start coming in.
any idea what i should be doing?
|

July 30th, 2012, 09:52 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
Put that new rule before the other and add an [L].
|

July 30th, 2012, 10:08 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 169
  
Time spent in forums: 1 Day 15 h 4 m 17 sec
Reputation Power: 14
|
|
|
thanks, i get this error in firefox when i do that.
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
|

July 30th, 2012, 11:13 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
Just to be sure, what's in your .htaccess right now?
|

July 30th, 2012, 11:28 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 169
  
Time spent in forums: 1 Day 15 h 4 m 17 sec
Reputation Power: 14
|
|
|
RewriteEngine on
Options +FollowSymlinks
RewriteRule ^folder1/actual_file.php /temp_file.php [R=301,L]
RewriteRule ^temp_file.php /folder1/actual_file.php [NS,L]
ErrorDocument 404 /404.php
|

July 31st, 2012, 12:15 AM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
Oh, right.
Try
Code:
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_URI} =/folder1/actual_file.php
RewriteRule ^ /temp_file.php [R=301,L]
RewriteRule ^temp_file.php /folder1/actual_file.php [NS,L]
ErrorDocument 404 /404.php
|

July 31st, 2012, 06:57 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 169
  
Time spent in forums: 1 Day 15 h 4 m 17 sec
Reputation Power: 14
|
|
|
still doesnt seem to work when i access actual_file.php
|

July 31st, 2012, 07:54 PM
|
 |
Still alive
|
|
Join Date: Mar 2007
Location: Washington, USA
|
|
|
Doesn't work how? No redirection? Infinite redirection?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|