Changeset 1489 for trunk/wp-admin/options-permalink.php
- Timestamp:
- 07/27/2004 11:37:45 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/options-permalink.php
r1438 r1489 45 45 <div class="updated"><p><?php _e('Permalink structure updated.'); ?></p></div> 46 46 <?php endif; ?> 47 48 <?php if(isset($_POST['rules'])) { 49 $rules = explode("\n", $_POST['rules']); 50 if(insert_with_markers(ABSPATH.'.htaccess', 'WordPress', $rules)) { 51 ?> 52 <div class="updated" id="htupdate"><p><?php _e('mod_rewrite rules written to .htaccess.'); ?></p></div> 53 <?php 54 } else { 55 ?> 56 <div class="updated" id="htupdate"><p><?php _e('Failed to write mod_rewrite rules to .htaccess.'); ?></p></div> 57 <?php 58 } 59 } 60 ?> 61 47 62 <div class="wrap"> 48 63 <h2><?php _e('Edit Permalink Structure') ?></h2> … … 108 123 ?> 109 124 <p><?php printf(__('Using the permalink structure value you currently have, <code>%s</code>, these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.'), $permalink_structure) ?></p> 110 <?php 111 $site_root = str_replace('http://', '', trim(get_settings('siteurl'))); 112 $site_root = preg_replace('|([^/]*)(.*)|i', '$2', $site_root); 113 if ('/' != substr($site_root, -1)) $site_root = $site_root . '/'; 114 115 $home_root = str_replace('http://', '', trim(get_settings('home'))); 116 $home_root = preg_replace('|([^/]*)(.*)|i', '$2', $home_root); 117 if ('/' != substr($home_root, -1)) $home_root = $home_root . '/'; 118 119 ?> 120 <form action=""> 125 <form action="options-permalink.php" method="post"> 121 126 <p> 122 <textarea rows="5" style="width: 98%;">RewriteEngine On 123 RewriteBase <?php echo $home_root; ?> 124 <?php 125 $rewrite = rewrite_rules('', $permalink_structure); 126 $rules = ''; 127 foreach ($rewrite as $match => $query) { 128 if (strstr($query, 'index.php')) { 129 $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA]\n"; 130 } else { 131 $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA]\n"; 132 } 133 } 134 echo apply_filters('rewrite_rules', $rules); 135 ?> 127 <textarea rows="5" style="width: 98%;" name="rules"><?php echo mod_rewrite_rules($permalink_structure); ?> 136 128 </textarea> 137 129 </p> 138 <?php printf(__('<p>If your <code>.htaccess</code> file is writable by WordPress, you can <a href="%s">edit it through your template interface</a>.</p>'), 'templates.php?file=.htaccess') ?> 130 <?php 131 if ((! file_exists(ABSPATH.'.htaccess') && is_writable(ABSPATH)) || is_writable(ABSPATH.'.htaccess')) { 132 ?> 133 <p class="submit"> 134 <input type="submit" name="writerules" value="<?php _e('Write mod_rewrite rules to .htaccess »') ?>"> 135 </p> 136 <?php } ?> 139 137 </form> 140 138
Note: See TracChangeset
for help on using the changeset viewer.